PHP code example of gollumsf / controller-action-extractor-bundle

1. Go to this page and download the library: Download gollumsf/controller-action-extractor-bundle 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/ */

    

gollumsf / controller-action-extractor-bundle example snippets


return [
    // [ ... ]
    GollumSF\RestBundle\ControllerActionExtractorBundle::class => ['all' => true],
];


use GollumSF\ControllerActionExtractorBundle\Extractor\ControllerActionExtractorInterface;

public function (ControllerActionExtractorInterface $extractor) { // Inject service
    
    // Get $route from router
    $controllerAction = $extractor->extractFromRoute($route);

    // Get $request
    $controllerAction = $extractor->extractFromRequest($request);

    // Get $request
    $controllerAction = $extractor->extractFromString('Controller::action');
    
    $controllerClass = $controllerAction->getControllerClass(); // Return controller class
    $actionMethod    = $controllerAction->getActionMethod();    // Return action method
    
}