Download the PHP package marksihor/laravel-query-filter without Composer

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

Laravel Query Filter

Installation

#### Install the package via composer: #### Publish the config files (needed if You're willing to change configs):

Usage

#### 1. Add "FiltersQueries" trait to Your Controller.php: #### 2. Use "$this->filter()" method in Your controllers like in example below: #### #### 3. Add public array $filterableColumns = []; // (it can improve querying speed by not using: Schema::hasColumn($table, $column) for checking column existence)

Configurations

## Filter Settings (configs/laravel_query_filter.php): #### Model Configuration: There are two ways to configure Models: - pass an array of parameters (in this case they will be processed every request) - pass an anonymous function (in this case extra logic can be provided) Model settings options (if not provided - the check will not be performed): - columns - the columns that will be displayed when retrieving records - relations - the relations that well be allowed to retrieve and filter (empty array - forbids all relations) #### Filters Configuration: The filters of application are listed in the filters array. To disable specific filter, simply delete the corespondent class from the list. It is easy to add Your own filter: - Create new filter class in Your application; - Implement the \LaravelQueryFilter\Filters\FilerInterface interface, and write the logic for the filter; - Add the created filter to filters list; #### Publish the config files (needed if You're willing to change configs):

Query Examples

## Filter by column (\LaravelQueryFilter\Filters\ColumnValuesFilter::class) Exact match: > example.com/api/posts?name=Post1 String that contains the substring (surround the serchable string with % character): > example.com/api/posts?text=%hello% Starts with the substring (put % character to the end of the serchable string): > example.com/api/posts?text=Error% Ends with the substring (put % character to the start of the serchable string): > example.com/api/posts?text=%provident. Json column filter (same syntax to find contains, starts with, ends with): > example.com/api/posts?data->name=John
> example.com/api/posts?data__name=John ## Filter by reserved words (\LaravelQueryFilter\Filters\ColumnValuesFilter::class) Records where value is null: > example.com/api/posts?status=null Records where value is not null: > example.com/api/posts?status=notNull Records where date is today: > example.com/api/posts?created_at=today Records where date is tomorrow: > example.com/api/posts?created_at=tomorrow Records where date is yesterday: > example.com/api/posts?created_at=yesterday Records where date is day beforeyesterday: > example.com/api/posts?created_at=day_before_yesterday Records where date is more than or equal current: > example.com/api/posts?created_at=future Records where date is less than or equal current: > example.com/api/posts?created_at=past Records where value is more than or equal to: > example.com/api/posts?likes[from]=100 Records where value is less than or equal to: > example.com/api/posts?likes[to]=200 Records where value is between range: > example.com/api/posts?likes[between]=100,200 Records where value is in the list: > example.com/api/posts?status[in]=active,disabled Records where value is not in the list: > example.com/api/posts?status[not_in]=active,disabled ## Ordering (\LaravelQueryFilter\Filters\OrderFilter::class) Order by asc: > example.com/api/posts?orderBy=title&order=asc Order by desc: > example.com/api/posts?orderBy=title&order=desc Order by json column: > example.com/api/posts?orderBy=data__key&order=desc
> example.com/api/posts?orderBy=data->key&order=asc Order asc/desc (old way): > example.com/api/posts?id[orderBy]=asc
> example.com/api/posts?id[orderBy]=desc ## Selecting columns (\LaravelQueryFilter\Filters\SelectColumnsFilter::class) Select columns by provided comma separated values: > example.com/api/posts?select=id,title ## Retrieving related records (\LaravelQueryFilter\Filters\WithCountRelationsFilter::class) ### Basic Direct relations by providing comma separated relation names: > example.com/api/posts?with=comments,user Nested relations by providing dot separated relationships structure: > example.com/api/posts?with=comments.user ### Advanced Direct relations with extra filters (select, order, filter by column): > example.com/api/posts?with[comments][select]=id,text,post_id&with[comments][orderBy]=id&with[comments][order] > =desc&with[comments][text]=%non% Nested relations with extra filters (select, with): > example.com/api/posts?with[user][with]=comments&with[user][select]=id&with[user][with][comments][select] > =id,post_id,user_id&select=id,user_id ## With count relationships (\LaravelQueryFilter\Filters\WithCountRelationsFilter::class) ### Basic Count direct relations by providing comma separated relation names: > example.com/api/posts?withCount=comments,user ### Advanced Count direct relations by providing relation and additional filters: > example.com/api/posts?withCount[comments][user_id]=8 > ## With sum relationships (\LaravelQueryFilter\Filters\WithSumRelationsFilter::class) ### Basic Sum direct relations by providing comma separated relation names and columns: > example.com/api/customers?withSum=payments.total,payments_paid.total ## Retrieving records that has relations (\LaravelQueryFilter\Filters\HasRelationsFilter::class) ### Basic By providing comma separated relation names: > example.com/api/posts?has=comments > example.com/api/posts?has=comments.user ### Advanced By providing relation names with additional filters: > example.com/api/posts?has[comments][id]=20 ## Retrieving records that does not have relations (\LaravelQueryFilter\Filters\HasNotRelationsFilter::class) ### Basic By providing comma separated relation names: > example.com/api/posts?hasNot=comments ### Advanced By providing relation names with additional filters: > example.com/api/posts?hasNot[comments][id]=13


All versions of laravel-query-filter with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.0
doctrine/dbal 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 marksihor/laravel-query-filter contains the following files

Loading the files please wait ....