Download the PHP package devaction-labs/filterable-package without Composer

On this page you can find all versions of the php package devaction-labs/filterable-package. 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-package

Filterable Package for Laravel

Filterable Package is a Laravel package designed to simplify filtering Eloquent models in your application. It provides an easy-to-use interface to apply various types of filters to your Eloquent queries, such as exact matches, partial matches (LIKE), date ranges, JSON-based filters, and more, directly from incoming requests. This package is especially useful for building APIs where dynamic filtering is often required.

Features

Installation

To install the package, use Composer:

Usage

Step 1: Apply the Filterable Trait to Your Model

Apply the Filterable trait to any Eloquent model you want to filter.

Step 2: Apply Filters in Your Controller

Apply filters in your controller methods using the filtrable scope provided by the Filterable trait.

Available Filters

Filter::exact($attribute, $filterBy = null)

Filter::like($attribute, $filterBy = null)

Filter::in($attribute, $filterBy = null)

Filter::gte($attribute, $filterBy = null)

Filter::lte($attribute, $filterBy = null)

Filter::json($attribute, $path, $operator = '=', $filterBy = null)

Custom Filter Mapping

You can map request parameters to different column names in your database. For example:

Now, if the request contains filter[search]=Pizza, the query will filter the description column for the value Pizza.

Benefits and Differentiators

Example Usage in API Controller

Pagination and Sorting

Custom Pagination

Use the customPaginate scope to apply pagination with customizable parameters.

Allowed Sorts and Default Sort

Define allowed sorts and a default sort order in your model.

Handling JSON Filters with Different Databases

The package supports JSON-based filters across different database systems by handling the JSON extraction appropriately.

Supported Databases:

Ensure that your database driver is correctly set to utilize the appropriate JSON extraction method.

Conclusion

The Filterable Package simplifies the process of filtering Eloquent models in Laravel. By leveraging the power of this package, you can create highly flexible and dynamic filtering solutions in your application, improving code quality and maintainability. With support for JSON-based filters, you can efficiently query nested JSON attributes, making your APIs more robust and versatile.

License

This package is open-sourced software licensed under the MIT license.


All versions of filterable-package with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2.0|^8.3.0
illuminate/database Version ^11.21
illuminate/http Version ^11.25
illuminate/support Version ^11.21
vlucas/phpdotenv Version ^5.6
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 devaction-labs/filterable-package contains the following files

Loading the files please wait ....