PHPackages                             yarooob/laravel-service-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yarooob/laravel-service-generator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

yarooob/laravel-service-generator
=================================

make your service layer classes easily

6291[1 PRs](https://github.com/Yarob50/LaravelServiceGenerator/pulls)PHP

Since Sep 8Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Yarob50/LaravelServiceGenerator)[ Packagist](https://packagist.org/packages/yarooob/laravel-service-generator)[ RSS](/packages/yarooob-laravel-service-generator/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

 [![](https://github.com/Yarob50/LaravelServiceGenerator/raw/master/assets/logo.png)](https://github.com/Yarob50/LaravelServiceGenerator/blob/master/assets/logo.png)

 ⭐ Laravel Service Generator 🚀
==============================

[](#-star-laravel-service-generator-)

###  Generate the service layer like you do for models, controllers.. etc 🤩

[](#-generate-the-service-layer-like-you-do-for-models-controllers-etc-)

👁 Quick Look
------------

[](#-quick-look)

It's common in many Laravel projects to introduce a new layer to the MVC architecture and to the project structure which is primarily used for lifting the heavy business logic of the app making the job of the controller limited on receiving the request and returning the response. One solution for achieving this is using the **Service Layer**. While you have artisan commands for creating migrations, models, controllers.. etc, you don't have one for creating the service classes as it's not part of the original Laravel project structure. Creating a service and making an interface for it (to prevent tight coupling) is a task that you would do again and again in your service-layer-based projects, and thankfully, **Laravel Service Generator** is here to save you some time. 🥳

**NOTE: I know that it's also common to use the Repository layer instead or even with the Service layer, however, this solution is not supported in this package yet and your contribution is always welcome 😄**

🏭 Installation
--------------

[](#-installation)

### Using Composer:

[](#using-composer)

```
composer require yarooob/laravel-service-generator

```

👨‍💻 Usage
---------

[](#‍-usage)

As you do for making a controller, you should use the following command:

```
php artisan make:service

```

Example:

```
php artisan make:service ItemsService

```

The above command will create two classes in `app\Http\Services` directory and these are: A. `ItemsService.php` which is the class of the service. B. `ItemsServiceInterface.php` which is the class of the interface of that service to help you avoiding the tight coupling with the controller and mocking your service for testing.

If you don't want to generate the Interface along with the service and limit the generation to the service only you can use `--no-interface`` option with the command.

```
php artisan make:service ItemsService --no-interface

```

Or you can make this to be the default behavior of the command by: 1- publishing the config:

```
php artisan vendor:publish --provider="Yarob\LaravelServiceGenerator\LaravelServiceGeneratorServiceProvider" --tag=config

```

2- changing the value of `create_interface_enabled` to be `false` in the published config file which you can find in: `config/laravelServiceGenerator.php`. After making this change, whenever you run `php artisan make:service `, only the Service class will be generated without the interface.

⚙️ Customization
----------------

[](#️-customization)

To Customize the stubs used for generating the files you can publish them by calling: `php artisan vendor:publish --provider="Yarob\LaravelServiceGenerator\LaravelServiceGeneratorServiceProvider" --tag=stubs ` which will publish three files in the `stubs` directory: A. **service.stub**: contains the content of the service class when the service is created along with service interface. B. **serviceInterface.stub**: contains the content of the service interface. C. **serviceOnly.stub**: contains the content of the service when it's created alone without the service interface.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29100623?v=4)[Yarob Al Mostafa (يعرُب)](/maintainers/Yarob50)[@Yarob50](https://github.com/Yarob50)

---

Top Contributors

[![Yarob50](https://avatars.githubusercontent.com/u/29100623?v=4)](https://github.com/Yarob50 "Yarob50 (19 commits)")

### Embed Badge

![Health badge](/badges/yarooob-laravel-service-generator/health.svg)

```
[![Health](https://phpackages.com/badges/yarooob-laravel-service-generator/health.svg)](https://phpackages.com/packages/yarooob-laravel-service-generator)
```

###  Alternatives

[kartik-v/yii2-widget-switchinput

A Yii2 wrapper widget for the Bootstrap Switch plugin to use checkboxes &amp; radios as toggle switchinputes (sub repo split from yii2-widgets)

384.4M13](/packages/kartik-v-yii2-widget-switchinput)[magenerds/germanlaw

This module provides general settings for german stores

2178.6k](/packages/magenerds-germanlaw)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
