Download the PHP package tgalfa/reposervice without Composer
On this page you can find all versions of the php package tgalfa/reposervice. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tgalfa/reposervice
More information about tgalfa/reposervice
Files in tgalfa/reposervice
Package reposervice
Short Description Generate repository, service and interface files for Repository-Service Pattern.
License MIT
Homepage https://github.com/tgalfa/reposervice
Informations about the package reposervice
RepoService Generator
RepoService Generator is a Laravel package that generates service and interface files for Repository-Service Pattern.
- The repository is a layer between the domain and data layers of your application to perform CRUD operations.
- A service applies the business logic of your application. It simply performs the a set task using the information provided, using any repositories or other classes you have created outside of the service.
Installation
You can install the package via composer:
You can publish the config file with:
You can set the Repository and Service folders path and namespaces in the config file:
All generated Services and Repositories extend an abstract class.
If you do not want to use the default AbstractMainService and AbstractMainRepository classes you can create your own and use those instead. Update your reposervice
config:
Usage
Before using the generate commdand you should customize config/reposervice.php
for your own use.
You can simply use reposervice:generate
and pass your model class as a parameter:
Available Methods
The following methods are available:
tgalfa\RepoService\Services\Contracts\MainServiceInterface
Example usage
Get Active Posts with the category_id = 5:
You need to create the relevent scopes in your Model class to use them. Example:
Get Paginated Posts:
Create a new Post in repository:
Update existing Post:
Update existing Post if all the given attributes matches or create a new Post:
Delete Post:
tgalfa\RepoService\Services\Contracts\MainRepositoryInterface
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.