Download the PHP package bahram/bfilters without Composer

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

Bahram Filter

Apply auto filters to Eloquent models.
Using this package, easily apply filters, sorting and pagination to Eloquent models and their relations, with query string parameters.

Requirements

php: ^8.0|^8.1
laravel: >=8.0

For miner php|Laravel versions use other releases.

Installation

Use HasFilter Trait On your Eloquent Models

Your models should use the HasFilter trait:

Create Filter Class

for example:

In your Created Filter Class :

Usage

In controllers :

In Api Request Query String :

Add Validation Rules

To validate filters before applying it, add this method to your filter class:

If you need custom filter on relation : (For example array search in postgresql) :

In Request

Json Search:

Assume you have a json column named address like this :

So you Can simply add Your Json Column(s) to your filter class, like this:

Then you can apply filters on your Model as simple as this :

filter:{"filters":[[{"field":"city_name","op":"=","value":"tehran"}],[{"field":"street_name","op":"=","value":"jordan"}]]}

Query String Samples:

pagination: per_page=10 :

?filter={"page":{"limit": 10,"offset": 0}}

pagination per_page=20 and (ordered by id desc) :

?filter={"page":{"limit":20,"offset":0},"sort":[{"field":"id","dir":"desc"}]}

add a filter : name like john :

?filter={"page":{"limit":20,"offset":0},"sort":[{"field":"id","dir":"desc"}],"filters":[[{"field":"name","op":"like","value":"john"}]]}

(first_name like alireza or last name like bahram) and (email = [email protected])

you can use magic filters as well:

without using field,op, and value (email = [email protected]):

full Text Search:

Basic Methods

Use Make Filter class to make a custom filter on an Api call

For example assume a function within your controller:

Edit given request filters

"addMagicFilter" method

"addOrder" method

use "setFilters" method to set multiple filters

use "getFilters" method to get the applied filters as an array

use "getFilter" method to get a specific filter

use "setWiths" method to eager loads some specific relations of the model

use "getWiths" method to get relations already set on given filters

use "setPage" method to set pagination on filters

use "getPage" method to get pagination already applied to the given request


All versions of bfilters with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0|^8.1
ext-json Version *
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 bahram/bfilters contains the following files

Loading the files please wait ....