Download the PHP package drewlabs/laravel-query without Composer
On this page you can find all versions of the php package drewlabs/laravel-query. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drewlabs/laravel-query
More information about drewlabs/laravel-query
Files in drewlabs/laravel-query
Package laravel-query
Short Description Provides drewlabs/query bindings for laravel framework
License MIT
Informations about the package laravel-query
Laravel Query Bindings
The laravel query package provides drewlabs/query
library bindings for laravel based projects. It uses Laravel
eloquent API for database queries.
Usage
Providers
- Laravel When using Laravel framework the service provider is automatically registered.
- Lumen For Lumen appliation you must manually register the providers in the bootstrap/app.php:
Components
The Query Language
This component offer a unified language for quering the database using SELECT, CREATE, UPDATE and DELETE methods. It heavily makes use of PHP dictionnary a.k.a arrays for various operations.
Creating instance of the DMLManager
Create
API
The method takes in the attributes to insert into the database table as a row.
Note: In it complex form, the create method takes in the attributes to insert and a set of parameters:
The create method also takes in a 3rd parameter PHP Closure
that can be executed after the create operation
Examples:
Update
API
As the create
method, the update
method also provides overloaded method implementations for interacting with the database.
Delete
API
Delete provides an interface for deleting items based on there id or a complex query.
Select
API
select
method of the DMLManger, provides a single method for querying rows in the database using either query filters.
Query filters
Filters provides a uniform interface to perform database queries.
CreateQueryFilters
API
CreateQueryFilters
is a factory function which when called create a filters binding for laravel database library.
The query filters API
The query filters API provides a list of filters that can be used to perform database query using PHP key-value pair array (a.k.a dictionnary) to send query using the framework database API.
Example
- Here is a list of query methods supported by the package:
Warning Entity objects/ Query models must implements the Drewlabs\Query\Contracts\Queryable
interface for it to be compatible with query method calls.
The command API
The command API provides functions for sending query to database using the framework API under the hood.
Select Query Action
SelectQueryAction
Proxy function provides a typo free function for creating database query action of type SELECT
.
-
SelectQueryAction($id [, array $columns, \Closure $callback])
- SelectQueryAction(array $query [, array $columns, \Closure $callback])
-
SelectQueryAction(array $query, int $per_page [?int $page = null, array $columns, \Closure $callback])
- SelectQueryAction(FiltersInterface $query [, array $columns, \Closure $callback])
- SelectQueryAction(FiltersInterface $query, int $per_page [?int $page = null, array $columns, \Closure $callback])
Update Query Action
UpdateQueryAction
Proxy function provides a typo free function for creating database query action of type UPDATE
.
-
UpdateQueryAction($id, array|object $attributes [, \Closure $callback])
-
UpdateQueryAction(array $query, array|object $attributes [, \Closure $callback])
- UpdateQueryAction(FiltersInterface $query, array|object $attributes [, \Closure $callback])
Delete Query Action
Creates a DELETE
type query action using user provided by function user.
-
DeleteQueryAction($id [, \Closure $callback])
-
DeleteQueryAction(array $query [, \Closure $callback])
- DeleteQueryAction(FiltersInterface $query [, \Closure $callback])
Create Query Action
Creates a CREATE
type query action using user provided by function user
-
CreateQueryAction(array $attributes [, array $params, \Closure $callback])
- CreateQueryAction(object $attributes, [, array $params , \Closure $callback])
Note To allow the creator function be more customizable, the function supports a second parameter that allow developpers to provides their own custom action handler.
All versions of laravel-query with dependencies
illuminate/database Version ^9.0|^10.0|^11.0
illuminate/pagination Version ^9.0|^10.0|^11.0
drewlabs/contracts Version ^0.3
drewlabs/core-helpers Version ^0.3
drewlabs/support Version ^0.3
drewlabs/query Version ^0.3