A minimal package to implement Service Design Pattern in Laravel. It will also bind interface and service class in the AppServiceProvider.php
.
composer require haroon-mahmood-4276/laravel-service-pattern
Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
If laravel's auto-discovery doesn't work, add following lines in providers
array in config/app.php
/*
* Package Service Providers...
*/
...
HaroonMahmood4276\LaravelServicePattern\PatternServiceProvider::class,
...
This command is used to implement Service Design Pattern in Laravel Project. It make a service class with interface. {--do-not-bind}
(optional) is used to prevent service and interface binding in AppServiceProvider.php
. {--without-interface}
(optional) prevents the interface class to be created by this command.
php artisan make:service {name} {--do-not-bind} {--without-interface}
protected $myInterface;
public function __construct(MyInterface $myInterface)
{
$this->myInterface = $myInterface;
}
- Fork this repo.
- Contribute in it.
- Open a pull request.
If you discover a security vulnerability within package, please send an e-mail to Haroon Mahmood via [email protected]. All security vulnerabilities will be promptly addressed.
This package is open-sourced software licensed under the MIT license.