2017 © Pedro Peláez
 

library laravel-services

Package to create services with artisan

image

rschaaphuizen/laravel-services

Package to create services with artisan

  • Tuesday, November 7, 2017
  • by rschaaphuizen
  • Repository
  • 1 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 19 % Grown

The README.md

Package to create services with artisan

This Laravel package creates an artisan command to generate services., (*1)

``` bash php artisan make:service NameService, (*2)


Optionally, you can create the service as an abstract class by adding the option: ``` bash php artisan make:service NameService --abstract

Register the created Service in the ServiceProvider (ex ServicesServiceProvider), (*3)

``` bash <?php, (*4)

namespace App\Providers;, (*5)

use App\Services\NameService; use Illuminate\Support\ServiceProvider;, (*6)

class ServicesServiceProvider extends ServiceProvider { /** * Bootstrap the application services. * * @return void */ public function boot() { // }, (*7)

/**
 * Register the application services.
 *
 * @return void
 */
public function register()
{
    $this->app->bind('NameService', function ($app) {
        return new NameService();
    });
}

}, (*8)


> **Registering the Service is not needed if the Service is created as an abstract class** Inject your service through your constructor of the desired controller ``` bash <?php namespace App\Http\Controllers; use App\Services\NameService; use Illuminate\Http\Request; class ExampleController extends Controller { /** * @var NameService */ protected $nameService; /** * ExampleController constructor. * @param NameService $nameService */ public function __construct(NameService $nameService) { $this->nameService = $nameService; } // the rest of your controller }

Installation and usage

This package requires PHP 7 and Laravel 5.5 or higher. Install the package by running the following command in your console;, (*9)

bash composer require rschaaphuizen/laravel-services, (*10)

Changelog

Please see CHANGELOG for more information what has changed recently., (*11)

Security

If you discover any security-related issues, please email r.schaaphuizen@sqits.nl instead of using the issue tracker., (*12)

Credits

License

The MIT License (MIT). Please see License File for more information., (*13)

The Versions

07/11 2017

dev-master

9999999-dev

Package to create services with artisan

  Sources   Download

MIT

The Requires

  • php ^7.0

 

laravel services artisan

07/11 2017

1.0.1

1.0.1.0

Package to create services with artisan

  Sources   Download

MIT

The Requires

  • php ^7.0

 

laravel services artisan

06/11 2017

1.0.0

1.0.0.0

Package to create services with artisan

  Sources   Download

MIT

laravel services artisan