Download the PHP package meiko/laravel-filterable without Composer

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

laravel-filterable

Build Status License: MIT

Use url parameters to easily sort, filter and search eloquent models.

Class documentation

Table of Contents

Click to expand

- [laravel-filterable](#laravel-filterable) - [Table of Contents](#table-of-contents) - [Getting started](#getting-started) - [Installation](#installation) - [Configuration](#configuration) - [Usage](#usage) - [Sorting](#sorting) - [Ascending order](#ascending-order) - [Descending order](#descending-order) - [Filtering](#filtering) - [Id columns](#id-columns) - [Custom filters](#custom-filters) - [Searching](#searching) - [Prerequisites](#prerequisites) - [Usage](#usage-1)

Getting started

Installation

Install with composer

Configuration

Create new configuration file filterable.php in your config directory (config/filterable.php).

Usage

To enable usage for your model, you need to apply the provided Filterable trait to your model.

Next, call the filters in your controllers.

Example:

Sorting

To sort your eloquent models, use the sort url param:

sort=<column-name>.

Ascending order

Example: Sort post's in ascending order by the posts updated_at column.

Descending order

To sort the results in descending order, prefix the url param value with -.

Filtering

To filter your eloquent models, you need to provide the column name, comparison type and value in the url.

<column-name>=<comparison-type>=<value>

Examples:

Fetch posts where the title column has text like Lorem ipsum

Fetch posts where the title is NOT like Lorem ipsum

Fetch posts where the read_count column has value bigger than 100.

Fetch posts where the title column contains one of: Lorem ipsum, Hello or First

NOTE: When providing multiple values, separate the elements with | character. Only the bw, not-bw, in, not-in comparison types support multiple values.

See Field.php for all the supported comparison types.

Id columns

If you need to filter models by one their relations and you use some kind of id obfuscation library (like hashids) then queries with obfuscated id's won't work.

To fix this, you can set custom idResolver (in config/filterable.php) to "decode" your id values before they are used in queries.

config/filterable.php

app/Models/IdResolver.php

Custom filters

If the provided comparison types are not enough or you wish to have some additional logic for the filtering process you can also create your own filters.

Example: Users have one-to-many relation with posts. We need to filter posts by their creators username.

Now we can use the username url param in our query.

Searching

Prerequisites

To use the search, you first need configure the columns which can be searched.

Usage

To search, use the _q url parameter.

The query tries to find matches for searchword in the Post's title and content columns.


All versions of laravel-filterable with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.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 meiko/laravel-filterable contains the following files

Loading the files please wait ....