{"id":22292030,"url":"https://github.com/aedart/athenaeum-filters","last_synced_at":"2025-07-28T23:33:01.201Z","repository":{"id":56899568,"uuid":"428169994","full_name":"aedart/athenaeum-filters","owner":"aedart","description":"[READ ONLY] Seach filters utilities, based on http query parameters - see https://github.com/aedart/athenaeum","archived":false,"fork":false,"pushed_at":"2025-07-21T08:07:36.000Z","size":137,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-21T10:13:12.512Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aedart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-11-15T07:51:50.000Z","updated_at":"2025-07-21T08:07:39.000Z","dependencies_parsed_at":"2023-02-12T21:45:15.564Z","dependency_job_id":"9a22ae37-276f-4985-af1e-5bf639fa38f0","html_url":"https://github.com/aedart/athenaeum-filters","commit_stats":{"total_commits":178,"total_committers":2,"mean_commits":89.0,"dds":0.3146067415730337,"last_synced_commit":"4194ff294e35fa12129d291d903eac92cd5deda3"},"previous_names":[],"tags_count":107,"template":false,"template_full_name":null,"purl":"pkg:github/aedart/athenaeum-filters","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aedart%2Fathenaeum-filters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aedart%2Fathenaeum-filters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aedart%2Fathenaeum-filters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aedart%2Fathenaeum-filters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aedart","download_url":"https://codeload.github.com/aedart/athenaeum-filters/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aedart%2Fathenaeum-filters/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267604307,"owners_count":24114521,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-12-03T17:19:20.430Z","updated_at":"2025-07-28T23:33:01.195Z","avatar_url":"https://github.com/aedart.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Athenaeum Filters\n\nOffers a way to create search and constraint [query filters](https://aedart.github.io/athenaeum/archive/current/database/query), based on received http query parameters, for your [Laravel](https://laravel.com/) application.\n\n## Example\n\n**Your custom filters builder**\n\nBy extending the `BaseBuilder` abstraction, you can encapsulate a custom filters builder.\nWhenever a http query parameter is matched, a corresponding \"processor\" is invoked, which is responsible for creating one or more query filters.\n\n```php\nnamespace Acme\\Filters;\n\nuse Aedart\\Filters\\BaseBuilder;\nuse Acme\\Filters\\Processors\\MySearchProcessor;\nuse Acme\\Filters\\Processors\\TextProcessor;\nuse Acme\\Filters\\Processors\\DateProcessor;\nuse Acme\\Filters\\Processors\\SortProcessor;\n\nclass UserFilterBuilder extends BaseBuilder\n{\n    public function processors(): array\n    {\n        // Key = http query parameter, value = parameter processor...\n        return [\n            'search' =\u003e MySearchProcessor::make(),\n            \n            'name' =\u003e TextProcessor::make(),\n            \n            'created_at' =\u003e DateProcessor::make(),\n            \n            'sort' =\u003e SortProcessor::make()\n                -\u003eforce(),\n            \n            // ...etc\n        ];\n    }\n}\n```\n\n**In your request**\n\nTo use your custom filters builder, create a new instance in your request, e.g. in the [after validation hook](https://laravel.com/docs/8.x/validation#after-validation-hook).\n\n```php\nnamespace Acme\\Requests;\n\nuse Illuminate\\Foundation\\Http\\FormRequest;\nuse Aedart\\Contracts\\Filters\\BuiltFiltersMap;\nuse Acme\\Filters\\UserFilterBuilder;\n\nclass ListUsersRequest exends FormRequest\n{\n    public BuiltFiltersMap|null $filters = null;\n\n    public function after(Validator $validator)\n    {        \n        // Add filters using your custom builder\n        $this-\u003efilters = UserFilterBuilder::make($this)\n            -\u003ebuild();\n    }\n\n    // ... remaining not shown ...\n}\n```\n\n**In your controller**\n\nLastly, apply the filters directly on your model.\n\n```php\nuse App\\Http\\Controllers\\Controller;\nuse App\\Models\\User;\nuse Acme\\Requests\\ListUsersRequest;\n\nclass UsersController extends Controller\n{\n    public function index(ListUsersRequest $request)\n    {\n        // Apply all requested filters...\n        return User::applyFilters($request-\u003efilters-\u003eall())\n            -\u003epaginate(10);\n        );\n    }\n}\n```\n\n## Official Documentation\n\nPlease read the [official documentation](https://aedart.github.io/athenaeum/) for additional information.\n\nThe mono repository is located at [github.com/aedart/athenaeum](https://github.com/aedart/athenaeum)\n\n## Versioning\n\nThis package follows [Semantic Versioning 2.0.0](http://semver.org/)\n\n## License\n\n[BSD-3-Clause](http://spdx.org/licenses/BSD-3-Clause), Read the LICENSE file included in this package\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faedart%2Fathenaeum-filters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faedart%2Fathenaeum-filters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faedart%2Fathenaeum-filters/lists"}