{"id":14983997,"url":"https://github.com/creativestyle/admin-list-bundle","last_synced_at":"2025-07-13T20:31:54.410Z","repository":{"id":56958961,"uuid":"166420246","full_name":"creativestyle/admin-list-bundle","owner":"creativestyle","description":"Easily create filterable, paginated lists in symfony","archived":false,"fork":false,"pushed_at":"2019-01-29T13:20:13.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-14T06:22:01.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/creativestyle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-18T14:49:29.000Z","updated_at":"2020-05-19T07:20:49.000Z","dependencies_parsed_at":"2022-08-21T09:50:31.083Z","dependency_job_id":null,"html_url":"https://github.com/creativestyle/admin-list-bundle","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativestyle%2Fadmin-list-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativestyle%2Fadmin-list-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativestyle%2Fadmin-list-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/creativestyle%2Fadmin-list-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/creativestyle","download_url":"https://codeload.github.com/creativestyle/admin-list-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225914108,"owners_count":17544486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:08:17.787Z","updated_at":"2024-11-22T14:36:34.271Z","avatar_url":"https://github.com/creativestyle.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Admin List Budle\n================\n\n## Setup\n\nYou might need to add to your `config/packages/framework.yaml`:\n```\n    templating:\n        engines: twig\n```\n\n## Templates\n\nThe templates are css-framework agnostic, you should override them (via symfony mechanism or by changing their config),\nextend the markup and style it.\n\n## Quickstart\n\n### In your controller\n\nGet the `FilterManager` instance. _This is a non-shared service, so you get new instance\nevery time._ \n\n```php\n/** @var FilterManager $filters */\n$filters = $this-\u003eget('creativestyle_admin_list.filter_manager');\n```\n\nSimilarly to form builder it exposes a fluent interface, so you can register new filters:\n\n```php\n$filters\n    -\u003eregisterFilter(new SomeFilter('filterid', ['some_config' =\u003e 'value']);\n    -\u003eregisterFilter(new SomeFilter('otherfilterid', ['some_config' =\u003e 'value'])\n;\n```\n\nYou can also register a paginator:\n\n```php\n$filters\n    -\u003esetPaginator(new SimplePaginator([\n        'order_by' =\u003e 'location.address.name',\n    ]))\n;\n```\n\nWhen you're done with configuration create a `QueryBuilder` and apply the filters, then \nfetch the results:\n\n```php\n$qb = $repository-\u003ecreateQueryBuilder('product');\n$filters-\u003eapplyFilters($qb);\n\n$results = $this-\u003egetFilterManager()-\u003egetPaginatedResults($queryBuilder);\n```\n\nYou will need both the results and `FilterManager` in your template:\n\n```php\nreturn $this-\u003erender('template.html.twig', [\n    'results' =\u003e $results,\n    'filters' =\u003e $filters,\n]);\n```\n\n### In your template\n\nYou can render each filter by id:\n\n```twig\n{{ filters.renderFilter('filterid')|raw }}\n```\n\nYou can also render the pagination controls like this:\n\n```twig\n{{ results.renderPaginationControls()|raw }}\n```\n\nFor rendering the results themselves use something like this:\n\n```twig\n\u003ctable\u003e\n    \u003cthead\u003e\n        \u003ctr\u003e\n            \u003cth\u003eId\u003c/th\u003e\n            \u003cth\u003e{{ filters.renderSortControls('entityalias.fieldname', 'Column Title')|raw }}\u003c/th\u003e\n            \u003cth\u003e{{ filters.renderSortControls('entityalias.createdAt', 'Created At')|raw }}\u003c/th\u003e\n        \u003c/tr\u003e\n    \u003c/thead\u003e\n    \n    {# The result object is iterable #}\n    \u003ctbody\u003e\n        {% for product in products %}\n            \u003ctr\u003e\n                \u003ctd\u003e{{ product.id }}\u003c/td\u003e\n                \u003ctd\u003e{{ product.fieldname }}\u003c/td\u003e\n                \u003ctd\u003e{{ product.createdAt|date }}\u003c/td\u003e\n            \u003c/tr\u003e\n        {% endfor %}\n    \u003c/tbody\u003e\n\u003c/table\u003e\n```\n\nAnd that's it! You've got a full-featured list UI with pagination, sorting and searching.\n\n## Filter reference\n\nBeside the built-in filters you can add your own by extending the base filters\nor the base ones like `AbstractFilter`. Please look at the code - it's really simple.\n\n### AbstractFilter\n\nBase for other filters, not for direct usage.\n\n__Options__\n\n`callback`\n\nCallable. If provided then it's used to apply the filter on the `QueryBuilder`.\nIf not provided then the internal filtering mechanism is used.\n\n`default_value`\n\nDefault value of the filter.\n\n`label`\n\nLabel, by default created by humanizing the filter id.\n\n`parameters`\n\nParameters which will be directly passed into the template\n\n`joins`\n\nThe joins to add to query if this filter is applied.\n\nAccepts an array of joins where each join is an array of this form:\n```\n['rootEntityAlias.fieldname', 'alias']\n```\n\n`template` \n\nThe template used for rendering.\n\n### DateFilter\n\n_Extends `AbstractFilter`_\n\nPresents a datepicker field.\n\n__Options__\n\n`empty_label`\n\nLabel to use when nothing is selected.\n\n`empty_value`\n\nValue when nothing is selected.\n\n`strategy`\n\nBy default EQUAL strategy is used.\n\nOne of:\n\n- DateFilter::STRATEGY_EQUAL\n- DateFilter::STRATEGY_GREATHER_THAN\n- DateFilter::STRATEGY_LESS_THAN\n- DateFilter::STRATEGY_GREATHER_THAN_OR_EQUAL\n- DateFilter::STRATEGY_LESS_THAN_OR_EQUAL\n\n`field`\n\nThe entity field that the filter will be applied to. \n\n### StringFilter \n\n_Extends `AbstractFilter`_\n\nPresent a text input. Allows searching multiple fields, using LIKE and more.\n\n__Options__\n\n`concat`\n\nIf true then the fields are concatenated before being searched.\n\n`wildcard`\n\nIf true then a wildcard `*` is allowed (will be substitued with `%` in the query). \n\n`fields`\n\nOne filed as string or a list of fields to search.\n\n`exact`\n\nIf true, then an exact match is needed (`LIKE` is not used).\nIf `concat` or `wildcard` is enabled then this is set to `false` by default. \nOtherwise the default is `true`.\n\n### Choice filter\n\n_Extends `AbstractFilter`_\n\nPresents a dropdown list or tabs.\n\n__Options__\n\n`empty_label`\n\nLabel to use when nothing is selected.\n\n`empty_value`\n\nValue when nothing is selected.\n\n`choices`\n\nArray of choices of the form `[value =\u003e label]`.\n\n`callback`\n\nThe callback is mandatory for this filter.\n\nUse it like this:\n\n```php\nnew ChoiceFilter('id', [\n    'choices' =\u003e [\n        'black' =\u003e 'Dark',\n        'white' =\u003e 'Light',\n    ],\n    'callback' =\u003e function (QueryBuilder $qb, $value) {\n        if ($value) {\n            $qb-\u003eandWhere('product.color = :choice')\n               -\u003esetParameter('choice', $value);\n        }\n    }\n]);\n```\n\n`disabled`\n\nDisable the filter?\n\n`tabbed`\n\nIf true then tabs are used instead of dropdown list.\n\n## Paginator reference\n\n### AbstractPaginator\n\nBase paginator, not for direct usage.\n\nTBD\n\n### SimplePaginator\n\nPresents user with a sliding paginator which may be slow with a lot of items because\nit has to do `COUNT` queries.\n\noptions TBD\n\n### OffsetPaginator\n\nPaginator for very big lists. It only allows _next_ and _previous_ navigation without\ngiving user the information of how many elements/pages are on the list.\n\noptions TBD","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreativestyle%2Fadmin-list-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcreativestyle%2Fadmin-list-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcreativestyle%2Fadmin-list-bundle/lists"}