This project is a template to create a new Drupal 9 website integrating non-fungible tokens.
NFTs can be imported as Media entity by simply copy/pasting their Url from major existing platforms such as OpenSea.io, Etherscan or Rarible. Polygon is also supported with
nftport module activated.
It is also possible to mint NFTs from any given Drupal content entity - e.g. a User, a Node (content), a Comment...etc. Minting NFT from Drupal - or any given PHP application - opens a new "bridge" between two worlds: "classical" web (websites/CMS) and the Web3 ecosystem.
Visit the module page for more information: https://drupal.org/project/nft
Import NFT into Drupal
In order to import NFT by copy/pasting their url, I rely on the oembed service existing in Drupal core. There is no "official" providers from any known NFT websites - see the full list here https://oembed.com/providers.json - so I have decided to create my own "provider".
The Drupal website actually registered itself as a new oembed provider - e.g nft_oembed module. It accepts URLs from major platform, parse them and request the NFT's information by calling the platform API - either OpenSea.io, Rarible.com or NFTPort API for now.
nft_oembed module activated, any editors can create a new Media in the backoffice, copy/pasting the URL and reuse this media:oembed:nft wherever needed in Drupal.
Mint NFT from Drupal entities
We have created a custom plugin manager in Drupal which allow developers to create "Minter" plugins in their own modules.
In backoffice, we give users an option to select an entity as being "mintable". If so, they can access a form, to configure the "mint" operation and run it.
For this hackathon we have developed one minter plugin based on NFTPort.xyz - EasyMinting API with File URL only (https://docs.nftport.xyz/docs/nftport/b3A6MjE2NjM5MDM-easy-minting-w-url).
We aim to create another minter which uses the Web3 PHP library (https://github.com/web3p/web3.php/) to let users call their own ERC721 contract to mint from Drupal. There is still of course a lot of room for improvement, especially to provide a way of "tracking" the minting history of an entity in Drupal.