PHP code example of mage / cli

1. Go to this page and download the library: Download mage/cli library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mage / cli example snippets

require_once "app/bootstrap.php"; $bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER); $om = $bootstrap->getObjectManager();


$product = $om->create('\Magento\Catalog\Model\Product')->load(1);
$product->getName();