Download the PHP package hasnath/queryable without Composer

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

Queryable

Total Downloads Latest Stable Version License

Introduction

Queryable gives you query builder helpers such as Filter and OrderBy to make APIs easier to create.

Requirements

The following is required to use Queryable

Installation

To get started, install Queryable via the Composer package manager:

Add the QueryableServiceProvider to your providers in config/app.php

Publish the configuration file

Configuration

The configuration file will be published config/queryable.php

Usage

Instantiate a new Queryable and pass in the Model to be used

Use the available Queryable methods

Filter

Queryable gives you the ability to easily filter database queries

Configuration

Specific configuration for the filter method can be found in the filter array inconfig/queryable.php

As default, all fields in a model can be filtered

To override which fields you want to filter by add the following in to your model

Any filters that contain a field that is not present in the model/filterable will be ignored.

Format

To apply filters, call the filter method on your Queryable instance. The filter method accepts two parameters: $query, $filters

The $query parameter is an instance of your query builder

The $filter parameter is an array of your filters in the following format

The FIELD and VALUE fields are required for each filter.

The OPERATOR field is optional and will default to =

The following OPERATORS can be used

You can apply as many filters as you would like.

For example, to apply filters for first_name and last_name:

The default separator for the filter method is ,

This value is retrieved from config/queryable.php filter.separator

To change the separator, update the filter.separator value in the config or add an .env variable

You will then need to pass filters in the following format

Usage Example

The following will pass any filters passed via the request and apply them

To get the users that have the first_name John and id greater than 3

OrderBy

Queryable gives you the ability to easily order database queries

Configuration

Specific configuration for the orderBy method can be found in the orderBy array inconfig/queryable.php

As default, you can apply an order on all fields in a model

To override which fields you want to order by add the following in to your model

Any orders that contain a field that is not present in the model/orderable will be ignored.

Format

To apply ordering, call the orderBy method on your Queryable instance. The orderBy method accepts two parameters: $query, $fields

The $query parameter is an instance of your query builder

The $fields parameter is an array of your order fields in the following format

The FIELD field is required for each order.

The ORDER field is optional and will default to ASC

The following ORDER values can be used

You can apply as many orders as you would like.

For example, to order by first_name and then last_name

The default separator for the orderBy method is ,

This value is retrieved from config/queryable.php orderBy.separator

To change the separator, update the orderBy.separator value in the config or add an .env variable

You will then need to pass filters in the following format

Usage Example

The following will pass any orders passed via the request and apply them

To order by the first_name in ascending order and then the id in descending order

License

Queryable is open-sourced software licensed under the MIT license.


All versions of queryable with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
ext-json Version *
illuminate/support Version ^7.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 hasnath/queryable contains the following files

Loading the files please wait ....