PHP code example of mvenghaus / magento2-script-bootstrap
1. Go to this page and download the library: Download mvenghaus/magento2-script-bootstrap 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/ */
mvenghaus / magento2-script-bootstrap example snippets
declare(strict_types=1);
use Mvenghaus\ScriptBootstrap\Bootstrap;
use Mvenghaus\ScriptBootstrap\Contracts\ScriptInterface;
use Magento\Framework\Filter\TranslitUrl;
// magento bootstrap
this->translitUrl->filter('Hello World');
}
}
Bootstrap::run(Script::class);
#[SetArea(\Magento\Framework\App\Area::AREA_ADMINHTML)]
#[SetSecureArea]
...
#[SetArea(\Magento\Framework\App\Area::AREA_ADMINHTML)]
#[SetSecureArea]
public function run(): void
{
echo $this->translitUrl->filter('Hello World');
}
...
bash
php script/hello-world.php