Download the PHP package aqjw/filterable without Composer

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

Filterable 📝

Latest Version on Packagist Total Downloads

The Filterable package is designed for Laravel 8.x+ and provides tools for creating and managing filters for Eloquent models. It makes it easy to scale filters and apply them to filter records.

Get Started 🚀

Installation

The package can be easily installed via Composer using the following command:

Adding the HasFilters Trait

After installation, add the HasFilters trait to the model that you want to filter:

Usage

Create a filter

To create a new filter, use the Artisan make:filter command:

You can also specify the column to be filtered:

In addition, you can specify a group for the filter:

The filter will then be created in the following group folder: \App\Filters\Product\ByCategory::class

Applying Filters

Once you have created your filters, you can apply them to your model:

You can use the or operator to apply multiple filters:

If you need to group filters, you can wrap them in an array:

Checking Request Parameters with the key Method

The key method in the filter class is used to check if a certain key exists in the request parameters. If the key is not present, the filter will not be applied.

Here is an example of how the key method can be used:

In this example, the ByPrice filter will only be applied if the price key is present in the request parameters.

Overriding the isActive Method

If you want to force a filter to be applied even if the corresponding key is not present in the request parameters, you can override the isActive method in the filter class.

Here is an example of how the isActive method can be used:

In this example, the ByCategory filter will always be applied, even if the category key is not present in the request parameters. If the category key is present, the filter will be applied based on its value. If the category key is not present, the filter will default to showing products in the root category (category ID of 1).

License

The Filterable package is open-sourced software licensed under the MIT License. Please see the License File for more information.

Contributing

Contributions are welcome! If you would like to contribute to this project, please follow these steps:

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/your-feature)
  3. Make your changes
  4. Push your branch to your forked repository (git push origin feature/your-feature)
  5. Open a pull request

All versions of filterable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 aqjw/filterable contains the following files

Loading the files please wait ....