PHP code example of fiko / magento2-adminurl

1. Go to this page and download the library: Download fiko/magento2-adminurl 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/ */

    

fiko / magento2-adminurl example snippets


php bin/magento setup:upgrade --keep-generated
php bin/magento setup:di:compile

class Example
{
    public function __construct(
        .......
        \Fiko\AdminUrl\Model\Url $adminUrl
        .......
    ) {
        .......
        $this->adminUrl = $adminUrl;
        .......
    }

    public function execute()
    {
        $catalogUrl = $this->adminUrl->getUrl('catalog/index/index');
    }
}