PHP code example of marcin-jozwikowski / easy-admin-pretty-urls

1. Go to this page and download the library: Download marcin-jozwikowski/easy-admin-pretty-urls 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/ */

    

marcin-jozwikowski / easy-admin-pretty-urls example snippets


   return [
     // ...
     MarcinJozwikowski\EasyAdminPrettyUrls\EasyAdminPrettyUrlsBundle::class => ['all' => true],
   ];
   

   public function configureCrud(): Crud
    {
        return parent::configureCrud()
            ->overrideTemplate('layout', '@EasyAdminPrettyUrls/layout.html.twig')
            ->overrideTemplate('crud/field/association', '@EasyAdminPrettyUrls/crud/field/association.html.twig');
    }
   

  #[PrettyRoutesController(path: 'special')]
  class AnyFancyController {
  
    #[PrettyRoutesAction(path: 'list')]
    public function index() {
      // .... 
    }
  }
  

  #[PrettyRoutesAction(path: 'modify/{entityId?0}')]
  public function edit(AdminContext $context)
  {
    return parent::edit($context);
  }
  

  #[PrettyRoutesController(actions: ['index', 'foo', 'bar'])]
  class AnyFancyController {
    // ...
  }
  
  /**
  * You can also (optionally) specify your own dashboard controller if you're using more than one in your project.
  * This will avoid to have an incorrect sidebar/user menu by addressing the request to the right dashboard controller
  */
  #[PrettyRoutesController(actions: ['index', 'foo', 'bar'], dasboard: YourCrudController::class . '::yourCrudAction')]
  class AnyFancyController {
    // ...
  }
  

  #[PrettyRoutesController(customActions: ['foo', 'bar'])]
  class AnyFancyController {
  ...