PHP code example of dittto / symfony-custom-request

1. Go to this page and download the library: Download dittto/symfony-custom-request 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/ */

    

dittto / symfony-custom-request example snippets


class AppKernel extends Kernel {
    public function registerBundles() {
        $bundles = [
            ...
            new \Dittto\CustomRequestBundle\DitttoCustomRequestBundle(),

use Dittto\CustomRequestBundle\Request\AbstractRequestType;

class TestRequest extends AbstractRequestType {
    public function validate():bool {
        return $this->getOriginalRequest()->query->get('token') === 'allowed';
    }
}

class DefaultController extends Controller {
    public function indexAction(TestRequest $request):Response {
        ...
    }
}