Package Data | |
---|---|
Maintainer Username: | noitran |
Maintainer Contact: | noitran.black@gmail.com (Noitran.Black) |
Package Create Date: | 2019-02-25 |
Package Last Update: | 2019-09-04 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-15 15:09:58 |
Package Statistics | |
---|---|
Total Downloads: | 13 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Package allows to use Resource Query Language (RQL) with Laravel's Eloquent ORM. Providers a simple and light-weight API for adding dynamic querying capabilities to HTTP based applications. Package functions as connector between HTTP requests and ORM. Currently only Eloquent Processor is included, but pacakge capabilities can be easly extended by adding new Processor.
$ composer require noitran/rql
use Noitran\RQL\Tests\Stubs\Models\User;
use Noitran\RQL\ExprQueue;
use Noitran\RQL\Processors\EloquentProcessor;
// Getting builder instance of model, or builder
// instance from noitran/repositories also can be passed.
$builder = User::query();
$queue = new ExprQueue();
// Creating expression
$exprClasses = $this->queue->enqueue(
new \Noitran\RQL\Expressions\EqExpr(null, 'name', 'John')
);
// Attaching expression into builder
$query = (new EloquentProcessor($this->builder))->process($exprClasses);
// Thats it! Expression has been applied. Can be checked by dumping query.
// Example:
dd($query->toSql());
// Dumps attached expression to sql:
// select * from "users" where "name" = ?
All samples can be viewed in testfile: Noitran\RQL\Tests\Processors\EloquentProcessorTest