Download the PHP package faiverson/gateway-pattern without Composer
On this page you can find all versions of the php package faiverson/gateway-pattern. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download faiverson/gateway-pattern
More information about faiverson/gateway-pattern
Files in faiverson/gateway-pattern
Package gateway-pattern
Short Description Abstraction Layer to use repository/gateway pattern in Laravel 5.5 with Fractal support
License Apache
Informations about the package gateway-pattern
Gateways
Gateways Installation
This package is a layer to interact between Controller and Model. If you want to create an abstraction layer to centralize all the queries in one class, instead of being adding models (eloquent queries) in a controller. What about to repeat that code in a command or observer or any other peace of the puzzle. This is where Gateways are handy! You only need to inject the Gateway dependency whereever you want.
- Install the package Gateways using composer:
composer require faiverson/gateway-pattern
- Run the command:
php artisan vendor:publish
Done!
How to Use
-
Go to the console and you can run:
make:gateways:controller Create a new controller class make:gateways:full Create a new Repository class make:gateways:gateway Create a new Gateway class make:gateways:interface Create a new Interface class make:gateways:model Create a new Eloquent model class make:gateways:repository Create a new Repository class
-Copy the line generated in your console into app/Providers/RepositoryServiceProvider.php e.g.$this->app->bind('App\Repositories\Interfaces\FooInterface', 'App\Repositories\FooRepository');
- create your route
License
This package is open-sourced software licensed under the Apache license.