thomasdcodes / list-view-bundle
A lightweight collection of entities for storing data of a listview.
Installs: 44
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/thomasdcodes/list-view-bundle
Requires
- php: >=8.3
- symfony/http-foundation: >=7.2.0
Requires (Dev)
- phpunit/phpunit: ^11.5
README
Description
This Bundle provides an easy-to-use set of different rich models packed into one wrapper ListControl to hold all information for a list view.
Its reason of life is only to hold the information and get richer at runtime of the app. For example, after init ListControl the Paginator in it doesn't know how many search results are found. You have the set the number of search results after querying your repo with the help of SearchTermOrganizer or FilterOrganizer, because the information of these models influence the number of search results.
Install
composer require thomasdcodes/list-view-bundle
If you're using Symfony Flex, the Bundle should be registered in your config/bundles.php
Quick start
With the bundle comes a factory to create the ListControl Model. There is only one static method of creating this model, for example in a controller:
use Tdc\ListViewBundle\Factory; public function __invoke(Request $request): JsonResponse { $listControl = ListControlFactory::createFromRequest($request); }
Content
The ListViewBundle contains the following models, which are all part of the container class ListControl:
- FilterOrganizer: Handles the filters from GET Parameter of the Request FilterOrganizer Documentation
- Paginator: A multi-stage process for generating relevant data for pagination Paginator Documentation
- SearchTermOrganizer: Handles the search term from GET Parameter of the Request SearchTermOrganizer Documentation
- SortOrganizer: Handles the sort from GET Parameter of the Request SortOrganizer Documentation