Download the PHP package mawuekom/laravel-data-repository without Composer
On this page you can find all versions of the php package mawuekom/laravel-data-repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mawuekom/laravel-data-repository
More information about mawuekom/laravel-data-repository
Files in mawuekom/laravel-data-repository
Package laravel-data-repository
Short Description Repository Pattern implementation for Laravel and Easily build Eloquent queries from API requests
License MIT
Homepage https://packagist.org/packages/mawuva/laravel-data-repository
Informations about the package laravel-data-repository
Repository Pattern implementation for Laravel and Easily build Eloquent queries from API requests
This is a Simple Repository Pattern implementation for Laravel Projects and an easily way to build Eloquent queries from API requests
Installation
You can install the package via composer:
Laravel
After register the service provider to the providers
array in config/app.php
Publish package config
Lumen
Go to bootstrap/app.php
, and add this in the specified key
Then, create config
folder in your root directory
Once done, create query-builder.php
in the config folder and add this config in it
Create also json-api-paginate.php
in the config folder and add this config in it
Once done all of this, go back to bootstrap/app.php
, and add the config files you created
This config allows you to filter, sort and include eloquent relations based on API requests.
It also allows to paginate and display data with the JSON API spec.
It using :
-
Laravel-query-builder to build queries
-
laravel-json-api-paginate that plays nice with the JSON API spec
Check on this links for more informations
Usage
This package has two repositories classes :
BaseRepository
which implements common methods for eloquent modelBaseApiRepository
that extends fromBaseRepository
and implements additional methods to build Eloquent queries from API requests
Using BaseRepository
Your repository will look like this
Your repository class should extends from Mawuekom\DataRepository\Repositories\BaseRepository
class which implements the interface Mawuekom\DataRepository\Repositories\Contracts\BaseRepositoryContract
that has the following methods :
Using BaseApiRepository
Your repository will look like this
Your repository class should extends from Mawuekom\DataRepository\Repositories\BaseApiRepository
class which extends Mawuekom\DataRepository\Repositories\BaseRepository
and implements the interface Mawuekom\DataRepository\Repositories\Contracts\BaseApiRepositoryContract
that has the following methods :
Hope this package will help you build awesome things
Report bug
Contact me on Twitter @ephraimseddor
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-data-repository with dependencies
illuminate/support Version ^8.0
illuminate/database Version ^8.0
mawuekom/laravel-macro-search Version ^1.0
spatie/laravel-json-api-paginate Version ^1.10
spatie/laravel-query-builder Version ^3.3