Download the PHP package lucasbedout/detective without Composer

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

Detective

Eloquent extension for advanced filtering. Designed to be used with URL parameters in API context.

Installation

composer require lucasbedout/detective

Configuration

Just replace Eloquent by the detective model in your model files.

If you need relationship filtering, just list your relationship methods like this.

Usage example

You can use the test laravel server provided with the package to test it, you have products, categories and stores table with configured relationships.

You can see the list of all valid syntaxes at the bottom of this file.

Add the corresponding route

Then just query it

/GET /products?name=iPhone*

Will return a list of products with their name starting with iPhone (caution, the search is case sensitive).

You can also query a relationship

/GET /products?category-name=Laptop

And even a pivot value

/GET /products/?category-name=Laptop&stores-pivot-quantity=>5 

This query will return all products in the Laptop category with at least one store where the quantity of products is > 5

You can also use the filter method with a custom array

The filter method returns a query builder, so you can chain any builder method you need.

Advanced informations

The Detective\Model class create a class context when you call the Detective::filter() method, it retrieves all fields and types from the database, then check your $relationships array and if there is one, it retrieves also your relationships informations (keys, type, ...).

The array passed to Detective::filter() is parsed, the Detective\Filters\Builder class make a correspondance between your array and the table informations, then the query is builded.

The Detective\Database\Context class has a lot of useful public methods, just check the code !

Valid filter syntaxes

3 atomic types

Filtering parameter name

You can use multiple syntaxe, each one corresponding to a model attribute or relation.

Filtering value format

Once you've named your parameter, you can provide the following values (all syntaxes work for relations or fields)

Number

You can combine

String

Date

Order

You can also provide an orderby parameter.

Development Roadmap


All versions of detective with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
illuminate/database Version ~5.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 lucasbedout/detective contains the following files

Loading the files please wait ....