PHP code example of akyos / ux-filters

1. Go to this page and download the library: Download akyos/ux-filters 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/ */

    

akyos / ux-filters example snippets




namespace App\Twig\Components\Product;

use Akyos\UXFilters\Class\Text;
use Akyos\UXFilters\Trait\ComponentWithFilterTrait;
use Akyos\UXPagination\Trait\ComponentWithPaginationTrait;
use App\Entity\Product;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\DefaultActionTrait;

#[AsLiveComponent]
final class Index extends AbstractController
{
    use DefaultActionTrait;
    use ComponentWithFilterTrait;
    use ComponentWithPaginationTrait;

    public function __construct()
    {
        $this->repository = Product::class;
        $this->setLimit(3);
    }

    protected function setFilters(): iterable
    {
        yield (new Text('name', 'Name'))->setSearchType('like')->setParams([
            'entity.name',
            'entity.description',
        ]);
    }
}