Download the PHP package coderscantina/laravel-filter without Composer

On this page you can find all versions of the php package coderscantina/laravel-filter. 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 laravel-filter

Filter Package from Coders' Cantina

A secure and optimized filter object for Laravel/Eloquent models based on the laracasts approach.

Features

Getting Started

Install

Require this package with composer:

Basic Usage

Define a filter:

In your model:

In your controller:

Advanced Operators

The package supports advanced filtering with operator-based syntax for more expressive queries. This feature allows you to easily implement complex filtering logic with minimal code.

Supported Operators

The following operators are supported:

Operator SQL Equivalent Description
null IS NULL Matches null values
!null IS NOT NULL Matches non-null values
eq = Equals (default if no operator specified)
neq != Not equals
empty Custom Matches empty strings or null values
!empty Custom Matches non-empty and non-null values
like LIKE Contains (adds wildcards around value)
!like NOT LIKE Does not contain (with wildcards)
^like LIKE Starts with (adds wildcard after)
like$ LIKE Ends with (adds wildcard before)
lt < Less than
gt > Greater than
lte <= Less than or equal to
gte >= Greater than or equal to
in IN In a list of values (comma-separated)
!in NOT IN Not in a list of values (comma-separated)

Basic Usage

To use advanced operators, extend from the AdvancedFilter class instead of ExtendedFilter:

Request Examples

Advanced Use Cases

Using with Range Filters

The advanced filtering still supports the range filter syntax (...) while adding operator capabilities:

Using with Date Filters

Similarly, date filters can use both traditional range and operator syntax:

Arrays of Values with Operators

You can combine multiple operator conditions for the same field:

Custom Operators

You can extend the supported operators by adding your own:

Implementation Details

If you're integrating the advanced filter functionality into an existing filter:

  1. Use the AdvancedFilterable trait in your filter class
  2. Extend from AdvancedFilter or add the trait to your custom filter class
  3. Update your filter methods to use applyDynamicFilter(), applyAdvancedRangeFilter(), or applyAdvancedDateFilter()

Security Considerations

The AdvancedFilter class maintains all the security features of the base Filter class:

Always use filter whitelisting in production to control which filters can be applied from user input:

Security Features

Filter Whitelisting

To enhance security, always specify which filters are allowed:

Input Sanitization

The package automatically sanitizes input to prevent SQL injection attacks. However, you should still validate your input in controllers using Laravel's validation system.

Advanced Features

Sortable Trait

The Sortable trait which is included in the ExtendedFilter offers sorting abilities:

Sort using foreign key relations:

Limit the number of sort columns for performance:

Restrict sortable columns:

Range Filters

Apply range filters in various formats:

Date Range Filters

Filter by date ranges with automatic formatting:

Pagination Support

Apply limit and offset for pagination:

Performance Optimizations

The package includes several optimizations:

Extending

Custom Filter Methods

Create custom filter methods in your filter class:

Override Core Methods

You can override core methods for custom behavior:

Testing

The package includes a comprehensive test suite:

Security Best Practices

  1. Always use filter whitelisting with setWhitelistedFilters()
  2. Validate input in your controllers
  3. Limit sortable columns to prevent performance issues
  4. Use type-hinting in your filter methods
  5. Test your filters thoroughly

Change Log

Please see CHANGELOG for more information on what has changed recently.


All versions of laravel-filter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/database Version ^8.0||^9.0||^10.0||^11.0||^12.0
illuminate/http Version ^8.0||^9.0||^10.0||^11.0||^12.0
illuminate/support Version ^8.0||^9.0||^10.0||^11.0||^12.0
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 coderscantina/laravel-filter contains the following files

Loading the files please wait ....