Download the PHP package jerome/filterable without Composer

On this page you can find all versions of the php package jerome/filterable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filterable

About Filterable

Latest Version on Packagist Tests Lint CodeQL PHPStan PHP Version License Total Downloads GitHub Stars

The Filterable package provides a robust, feature-rich solution for applying dynamic filters to Laravel's Eloquent queries. With a modular, trait-based architecture, it supports advanced features like intelligent caching, user-specific filtering, performance monitoring, memory management, and much more. It's suitable for applications of any scale, from simple blogs to complex enterprise-level data platforms.

Requirements

Features

Installation

To integrate the Filterable package into your Laravel project, install it via Composer:

The package automatically registers its service provider with Laravel's service container through auto-discovery (Laravel 5.5+).

For older Laravel versions, manually register the FilterableServiceProvider in your config/app.php file:

Usage

Creating a Filter Class

Create a new filter class using the Artisan command:

This command supports several options:

Option Shortcut Description
--basic -b Creates a basic filter class with minimal functionality
--model=ModelName -m ModelName Generates a filter for the specified model
--force -f Creates the class even if the filter already exists

Examples:

The command generates a filter class in the app/Filters directory. Extend the base Filter class to implement your specific filtering logic:

Adding Custom Filters

To add a new filter, define a method within your filter class using camelCase naming, and register it in the $filters array:

Implementing the Filterable Trait and Interface

Apply the Filterable interface and trait to your Eloquent models:

Applying Filters

Basic usage:

In a controller:

Laravel 12 Support

For Laravel 12, which has moved to a more minimal initial setup, make sure to follow these additional steps:

  1. Service Registration: If you're using a minimal Laravel 12 application, you may need to manually register the service provider in your bootstrap/providers.php file:

  2. Invokable Controllers: If you're using Laravel 12's invokable controllers, here's how to apply filters:

  3. Route Registration: Using the new routing style in Laravel 12:

Advanced Features

Feature Management

Selectively enable features for your filter:

Available Features

The Filterable package supports the following features that can be enabled or disabled:

Feature Description
validation Validates filter inputs before applying them
permissions Enables permission-based access to filters
rateLimit Controls filter complexity and prevents abuse
caching Caches query results for improved performance
logging Provides comprehensive logging capabilities
performance Monitors execution time and query performance
optimization Optimizes queries with selective columns and eager loading
memoryManagement Optimizes memory usage for large datasets
filterChaining Enables fluent chaining of multiple filter operations
valueTransformation Transforms input values before applying filters

Each feature can be enabled independently based on your specific needs:

User-Scoped Filtering

Apply filters that are specific to the authenticated user:

Pre-Filters

Apply pre-filters that run before the main filters:

Validation

Set validation rules for your filter inputs:

Permission Control

Define permission requirements for specific filters:

Rate Limiting

Control the complexity of filter requests:

Memory Management

Optimize memory usage for large datasets:

Query Optimization

Optimize database queries:

Caching

Configure caching behavior:

Logging

Configure and use logging:

Performance Monitoring

Track and analyze filter performance:

Filter Chaining

Chain multiple filter operations with a fluent API:

Value Transformation

Transform filter values before applying them:

Conditional Execution

Use Laravel's conditionable trait for conditional filter application:

State Management

Monitor and manage the filter execution state:

Debug Information

Get detailed information about the applied filters:

Error Handling

Customize exception handling for your filters:

Complete Example

Frontend Usage

Send filter parameters as query parameters:

Testing

Testing your filters using PHPUnit:

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Contributing

Contributions are welcome and greatly appreciated! If you have suggestions to make this package better, please fork the repository and create a pull request, or open an issue with the tag "enhancement".

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/amazing-feature)
  3. Commit your Changes (git commit -m 'Add some amazing-feature')
  4. Push to the Branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Authors

See also the list of contributors who participated in this project.

Acknowledgments


All versions of filterable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3 | ^8.4
illuminate/cache Version ^11.0|^12.0
illuminate/contracts Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
illuminate/support Version ^11.0|^12.0
laravel/pint Version ^1.21
nesbot/carbon Version ^2.72|^3.0
spatie/laravel-package-tools Version ^1.11
tightenco/duster Version ^3.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jerome/filterable contains the following files

Loading the files please wait ....