Download the PHP package abdallahmohammed/laravel-eloquent-filter without Composer

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

Laravel Eloquent Filter

A simple Laravel, and Lumen package to filter models, and relations

Installation

Laravel

via composer

Edit config/app.php (Skip this step if you are using laravel 5.5+)

Copy the package config to your local config

In the config/laravel-eloquent-filter.php config file. Set the namespace your model filters will reside in

Lumen

This is only required if you want to use the php artisan make:filter command.

In bootstrap/app.php

Change The Default Namespace

In bootstrap/app.php

Usage

Generating the filter

You can create a model filter with the following artisan command

Where User is the Eloquent Model name you are creating the filter for. This will create app/Http/Filters/UserFilter.php

The command also supports psr-4 namespacing for creating filters.

Defining filters

After generating the filter for an Eloquent Model you will find something like that in the filters directory

As you can see there is an protected property called $filters there you can define all filters for the Model.

For example:

Bear in mind that all methods filter must be based on camel case

Now after defining filters, let's define the methods that will filter the query

Side note: the empty values are not ignored by default so if you want to filter only for non-empty values you have to check if the value is not empty, or you can simply change it for the package config file

Now let's imagine that you want to show a user called John even if the filter is not exists you have to do something like that.

This method will be called if the filter called name does not exists

Applying The Filter To A Model

Implement the LaravelEloquentFilter\Filterable trait on any Eloquent Model:

This gives you access to the filter() method that accepts a BaseFilter instance:

Another example:

Contributing

Any contributions are welcome !!


All versions of laravel-eloquent-filter with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
laravel/framework Version 5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0|^8.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 abdallahmohammed/laravel-eloquent-filter contains the following files

Loading the files please wait ....