Download the PHP package skover/eloquent-builder without Composer

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

Provides a Eloquent query builder for Laravel 5

Build Status Coverage Status StyleCI Latest Stable Version Total Downloads License

This package allows you to build eloquent queries, based on request parameters. It greatly reduces the complexity of the queries and conditions, which will make your code cleaner.

Installation

Laravel 5.5 uses Package Auto-Discovery, so you are not required to add ServiceProvider manually.

Laravel <= 5.4.x

If you don't use Auto-Discovery, add the ServiceProvider to the providers array in config/app.php file

And add the facade to your config/app.php file

Default Filters Namespace

The default namespace for all filters is App\EloquentFilters\ with the base name of the Model.

For example:

Suppose we have a User model with an AgeMoreThan filter.As a result, the namespace filter must be as follows:

App\EloquentFilters\User\AgeMoreThanFilter

With Config file

You can optionally publish the config file with:

And set the namespace for your model filters which will reside in:

Usage

Suppose we want to get the list of the users with the requested parameters as follows:

In the legacy code the method written below was followed:

But the new method with EloquentBuilder follows the steps below:

Note: It's recommended validates the incoming requests before sending to filters.

Define a Filter

Writing a filter is simple. Define a class that implements the Fouladgar\EloquentBuilder\Support\Foundation\Contracts\IFilter interface. This interface requires you to implement one method: apply. The apply method may add where constraints to the query as needed:

Ignore Filters on null value

Filter parameters are ignored if contain empty values or null.

Suppose we have a request something like:

Only the "published_post" filter will be applied on your query.

Work with existing queries

You may also want to work with existing queries. For example, consider the following code:

Use as Dependency Injection

Suppose you want use the EloquentBuilder as DependencyInjection in a Repository.

Let's have an example.We have a sample UserRepository as follows:

The filters method applies the requested filters to the query by using EloquentBuilder injected.

Injecting The Repository

Now,we can simply "type-hint" it in the constructor of our UserController:

Testing

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

License

Eloquent-Builder is released under the MIT License. See the bundled LICENSE file for details.

Built with :heart: for you.


All versions of eloquent-builder with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
laravel/framework Version ~5.5.0|~5.6.0|~5.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 skover/eloquent-builder contains the following files

Loading the files please wait ....