PHP code example of azjezz / input-hydrator-bundle

1. Go to this page and download the library: Download azjezz/input-hydrator-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/ */

    

azjezz / input-hydrator-bundle example snippets


// config/bundles.php


return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    ...
    AzJezz\Input\HydratorBundle\InputHydratorBundle::class => ['all' => true],
];

// src/Input/Search.php


declare(strict_types=1);

namespace App\Input;

use AzJezz\Input\InputInterface;

final class Search implements InputInterface
{
    public string $query;
}

// src/Controller/SearchController.php


declare(strict_types=1);

namespace App\Controller;

use App\Input\Search;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

final class SearchController
{
    /**
     * @Route("/search", methods={"GET"})
     */
    public function index(Search $search): Response
    {
        return new Response('You were looking for "'.$search->query.'"?');
    }
}