Download the PHP package alterindonesia/service-pattern without Composer
On this page you can find all versions of the php package alterindonesia/service-pattern. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package service-pattern
Laravel Service Pattern
This package provide a service pattern for Laravel application. This package use the default concept of MVC but with additional Service Layer. We not change default logic of Laravel feature like Request, Resource, etc. Here the layer of this package:
- Request comes from Route to Controller via FormRequest Laravel.
- In controller, there is validation based on FormRequest instance.
- After validation succeed, controller call Service Layer via Laravel Service Provider binding feature.
- Service Layer will process the business logic and return the result to controller.
- Controller will return the result to client via Resource.
- Resource will format the result to client.
Installation
Usage
-
Update your Controller.php in app/Http/Controllers folder.
- Your controller should be like:
you can change the request and response based on your need.
- Create your service in app/Services folder.
-
Create Service via artisan command:
-
Your service should be like:
- It will auto generate for CRUD operation, you can override the method based on your need.
-
Your route will be like:
-
Now, bind your service in AppServiceProvider.php
- Done, now you can use this package in your Laravel application.
FAQ
- why you not use RepositoryLayer?
- personally, I think Repository Layer is not necessary because Laravel Eloquent is already powerful.
- but, you can create your own Repository Layer in Service Layer if you want.
Next Feature
- [ ] Add Service Layer for Query Builder
- [ ] Add Yajra Datatables Service Layer
- [ ] Add Service Layer for Import/Export
- [ ] we think about it
All versions of service-pattern with dependencies
PHP Build Version
Package Version
Requires
spatie/laravel-query-builder Version
^6.3.1
The package alterindonesia/service-pattern contains the following files
Loading the files please wait ....