Releases: devaction-labs/filterable-package
v1.0.21
Merge pull request #17 from devaction-labs/fix/filter-json Fix/filter json
🚀 [v1.0.20]
Merge pull request #16 from devaction-labs/feature/readme docs(README): update package description and features
🚀 [v1.0.19]
Merge pull request #15 from devaction-labs/roolback Roolback
🚀 [v1.0.18] - Caching Support and Performance Improvements
Merge pull request #14 from devaction-labs/feature/new-feture-cache chore: update version to v1.0.18 in composer.json
🚀 [v1.0.17] - Caching Support and Performance Improvements
✨ What's New
- Added a caching layer to the Filterable trait using
CacheManager, significantly improving query performance by caching filter results. - Cache keys are generated intelligently based on request parameters and filter criteria, reducing redundant database queries.
⚙️ Features
- Automatic caching of filter results.
- Configurable cache behavior (enabled/disabled, TTL, custom prefix).
- New
FilterableServiceProviderwith auto-discovery for easier setup.
🔧 Improvements
- Optimized query performance with caching layer.
- Cleaner and more maintainable filter logic.
⚠️ Potential Impacts
- Requires proper cache invalidation to avoid serving stale data after database updates.
- Increased test complexity due to added caching layer.
📖 Upgrade Guide
Run the following command to publish the configuration file:
php artisan vendor:publish --tag=filterable-config🚀 Improvement: Caching Implementation for Optimized Performance
This update introduces caching support to the Filterable package, significantly enhancing query performance by reducing redundant database hits. The core addition, CacheManager, ensures optimal caching by storing results based on unique filter criteria and request parameters. Cached items are intelligently managed using Laravel's built-in cache mechanisms, including tag-based invalidation for simplified cache clearing.
Highlights:
- ✅ Automatically caches results of frequent filter queries.
- ✅ Caches are invalidated using Laravel tags (
filterable), enabling efficient and isolated clearing of cached data. - ✅ Configurable caching behavior (TTL, prefix, and enabling/disabling cache globally via config).
Potential Drawbacks:
- Requires careful handling to ensure the cache is invalidated after relevant data changes; otherwise, it might serve outdated data.
- Slightly increases complexity, as tests now must account for caching layers and potential mocking intricacies.
Overall, this enhancement promotes better performance with minimal drawbacks when configured and tested properly.
Compatibilite laravel 12
Compatibilite laravel 12
Fix for per_page parameter issue when using Laravel Octane
Description:
This release addresses an issue where the per_page parameter was ignored in the production environment when using Laravel Octane with Swoole. The underlying cause was related to how Request::capture() is cached in memory. The fix involved replacing it with request(), ensuring that pagination works as expected across all requests.
Fix: Proper Handling of BETWEEN Filter in Filterable Package
Pull Request (PR) Description
This PR addresses the issue with the BETWEEN operator in the Filterable Package, ensuring correct SQL queries are generated and executed. The main changes include:
Proper Parsing of BETWEEN Values:
The setValueFromRequest method now correctly transforms request strings (e.g., "2025-01-17,2025-01-19") into arrays for whereBetween.
Added validation to ensure the BETWEEN filter value is always an array with exactly two elements.
Dedicated Logic for BETWEEN:
In the scopeFilterable method, the BETWEEN logic was isolated and implemented with the whereBetween query builder method.
The use of continue ensures no redundant conditions are applied after BETWEEN.
Enhanced Error Handling:
Invalid values for BETWEEN now throw clear exceptions (InvalidArgumentException) to assist debugging.
Key Changes
Filter Class:
Improved setValueFromRequest to parse and validate BETWEEN values properly.
Added strict checks to ensure BETWEEN receives valid input.
Filterable Trait:
Isolated BETWEEN logic in scopeFilterable, ensuring it handles whereBetween exclusively.
Prevented redundant conditions with the use of continue.
## [1.0.12] - Fix: Handle `BETWEEN` Filter for String Input
[1.0.1] - Fix: Handle BETWEEN Filter for String Input
Description:
This release fixes an issue with the BETWEEN filter, ensuring that comma-separated string inputs are correctly parsed into arrays before applying the filter. This improvement resolves exceptions caused by improper value handling.
What's Fixed:
BETWEENFilter Parsing: Values forBETWEENfilters passed as comma-separated strings (e.g.,2025-01-19,2025-01-19) are now correctly parsed into arrays.- Improved Validation: Validates the
BETWEENfilter value to ensure it is a two-element array and throws meaningful exceptions if invalid.
Example Usage:
API Request:
GET /orders?filter[created_at]=2025-01-19,2025-01-19