Skip to content

A minimal package to implement Service Design Pattern in Laravel. It will also bind interface and service class in the AppServiceProvider.php.

License

Notifications You must be signed in to change notification settings

haroon-mahmood-4276/laravel-service-pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Service Pattern

A minimal package to implement Service Design Pattern in Laravel. It will also bind interface and service class in the AppServiceProvider.php.

Latest Stable Version Total Downloads License PHP Version Require

Installation

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,
...

Command

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}

How to use

protected $myInterface;

public function __construct(MyInterface $myInterface)
{
  $this->myInterface = $myInterface;
}

Want to contribute

  • Fork this repo.
  • Contribute in it.
  • Open a pull request.

Security Vulnerabilities

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.

License

This package is open-sourced software licensed under the MIT license.

About

A minimal package to implement Service Design Pattern in Laravel. It will also bind interface and service class in the AppServiceProvider.php.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages