madeweb/service-layer

The service layer for Laravel

dev-master 2020-01-09 00:03 UTC

This package is auto-updated.

Last update: 2025-04-20 23:00:02 UTC


README

Packagist GitHub stars

This package allow generate service layer for abstraction the classes of the business logic and decoupling calls to models. My advice is use this layer of abstraction as intermediate between controllers and models.

Installation

composer require madeweb/service-layer

Generate service base class and custom service class

    php artisan make:service ServiceName  

Generate service base class and custom service class with custom model

    php artisan make:service ServiceName --model=App\\Models\\ModelName

For Lumen and Laravel version without discovery package

In file bootstrap/app.php (Lumen)

    $app->register(Madeweb\ServiceLayer\ServiceLayerProvider::class);

In file config/app.php (Laravel without discovery package)

 'providers' => [
        /*
         * Custom Service Providers...
         */
        Madeweb\ServiceLayer\ServiceLayerProvider::class,
  ];