Download the PHP package sofronz/elysia without Composer
On this page you can find all versions of the php package sofronz/elysia. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package elysia
Elysia ๐โจ
A powerful, customizable query string filter package for Laravel that lets you filter, sort, and search models using query parameters โ without writing repetitive query logic.
๐ Features
- ๐ Sort by fields with ease
- ๐ Search using LIKE
- ๐ฅ Filter with IN clause
- ๐ฏ Supports custom query string mapping per model
- ๐งฉ Fully extensible and easy to integrate
- ๐งผ Clean, well-structured codebase
๐ฆ Installation
๐ ๏ธ Configuration
Publish the config (optional):
config/elysia.php
:
โ๏ธ Usage
In your controller:
๐ Custom Query Parameters
By default, the Filter
package applies filters using query parameters such as ?field_sort=field_name
, ?field_like=value
, and ?field_in=value1,value2
. However, you can customize the query parameter names directly in your model.
Step 1: Add getQueryStringMapping
Method in the Model
To customize the query parameters, implement a getQueryStringMapping
method in your model. This method should return an array where the keys are the custom query parameters, and the values are the corresponding model fields.
In the example above, the custom query parameters are:
name_search
will filter byname
field.email_like
will perform a LIKE search on theemail
field.status_in
will filter bystatus
field using theIN
clause.created_at_sort
will sort bycreated_at
field.
Step 2: Apply the Filters with Custom Query Parameters
Now that you've defined custom query parameters in the model, you can use them directly in the request.
Example:
This will:
- Search for records where the
name
field contains "John". - Perform a
LIKE
search on theemail
field. - Filter records where the
status
is either "active" or "inactive". - Sort the records by the
created_at
field in descending order.
Available Filters
- Sort: Add a custom query parameter like
?field_sort=field_name
to apply sorting. - LIKE: Add a custom query parameter like
?field_like=value
to perform a LIKE search. - IN: Add a custom query parameter like
?field_in=value1,value2
to filter using theIN
clause. - Basic Where: Add custom query filters by passing fields that exist in the model's
$fillable
attribute.
By using the getQueryStringMapping
method, you can easily customize and map query parameters to any field in your model, giving you full control over how filters are applied in your application.
๐ Shout Out
Special thanks to ChatGPT ๐ค for assisting with the design and development of this package.
If you like my work or find it useful, you can support me through:
๐จโ๐ป Author
Sofronius Ruddy (GitHub: @sofronz)
Copyright (c) 2025
All rights reserved.
๐ License
MIT ยฉ 2025 Sofronz/Elysia. All rights reserved.
All versions of elysia with dependencies
illuminate/database Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/support Version ^8.0|^9.0|^10.0|^11.0|^12.0
illuminate/http Version ^8.0|^9.0|^10.0|^11.0|^12.0