PHPackages                             ins0mniac/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. ins0mniac/service-generator

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

ins0mniac/service-generator
===========================

The package provide commands for generating services and interfaces and registering them in the dependency container

v1.0.0(4y ago)015MITPHPPHP &gt;=v7.3

Since Mar 25Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ins0mniac1/laravel-service-generator)[ Packagist](https://packagist.org/packages/ins0mniac/service-generator)[ RSS](/packages/ins0mniac-service-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Laravel Service generator for Laravel applications
===================================================

[](#laravel-service-generator-for-laravel-applications-)

Introduction
------------

[](#introduction)

Service generator provides commands to create services, interfaces and providers and register the dependencies in the dependency container.

With this package, you can generate new files (services, interfaces and providers) only with "artisan" command just as controllers creation. It is not necessary to list the provider in app.php file. The process of listing providers in app.php and registering the dependencies in the providers is automated.

The list of the available commands are shown below:

Features
--------

[](#features)

- Laravel &gt;= v8.0 are supported;
- Easy setup, no additional configuration;
- Easy to use;
- It's made only to facilitate the work of developers;
- Free and always be free.

Official Documentation
----------------------

[](#official-documentation)

- [Installation](#install);
- [Commands](#commands):
    - [Service creation](#services):
        - [Plain service](#plain-service);
        - [Service with implementation](#service-with-implementation);
    - [Interface creation](#interfaces);
        - [Interface only](#interface-only);
        - [Generate interface and implement it from service](#implement-interface);
    - [Provider creation](#providers);
        - [Provider only](#provider-only);
        - [Register dependency in new or existing provider](#register-dependency);
- [Examples of generated files](#examples);
- [Coming soon](#next-stage);
- [License](#license).

Installation
------------

[](#installation)

[](install)

You can install this package via [Composer](http://getcomposer.org/) by running this command:

```
composer require ins0mniac/service-generator
```

> **NOTE :** The package will automatically register itself.

Commands
--------

[](#commands)

### For services creating:

[](#for-services-creating)

#### Plain service

[](#plain-service)

You can generate plain service (php file) with :

```
$ php artisan create:service NameOfTheService
```

If you don't specify the name of the service, Laravel will ask you to type it.

```
$ php artisan create:service
```

With this command, Laravel will generate new file with all the necessary attributes as namespace, class name, etc. The file will be generated in Services/\* directory (based of the name of the service), so if you type service name as `Users/User`, the service file will be located in `Services/Users` with name of `UserService`.

#### Service with implementation

[](#service-with-implementation)

You can generate service which implements interface:

`class NameOfTheService impements NameOfTheInterface`

```
$ php artisan create:service NameOfTheService --interface NameOfTheInterface
```

or just

```
$ php artisan create:service --interface
```

If you don't specify name of the service and/or interface, Laravel will ask you for them.

After you type the interface name, Laravel will ask you if you want to register dependency in the container. If you want to register it, just type `y` and enter the name of the Provider (if provider didn't exists, the command will create new one and publish it in app.php). After entering the provider name, you should specify the type of the registering - bind or singleton.

> **NOTE :** This command will create new service file, so if you shouldn't type name of the existing file!

In the end of the generation process you will have:

- New Service class (new file);
- Service class that implements new or existing Interface;
- Registered dependency in new or existing Provider;

### For interfaces creating:

[](#for-interfaces-creating)

#### Interface only

[](#interface-only)

You can generate only interface (php file) with :

```
$ php artisan create:interface NameOfTheInterface
```

If you don't specify the name of the interface, Laravel will ask you to type it.

```
$ php artisan create:interface
```

#### Generate interface and implement it from new or existing service

[](#generate-interface-and-implement-it-from-new-or-existing-service)

You can generate interface and implement it:

`class NameOfTheService impements NameOfTheInterface`

```
$ php artisan create:interface NameOfTheInterface --service NameOfTheService
```

or just

```
$ php artisan create:interface --service
```

If you don't specify name of the interface and/or service, Laravel will ask you for them.

After you type the interface name, Laravel will ask you if you want to register dependency in the container. If you want to register it, just type `y` and enter the name of the Provider (if provider didn't exists, the command will create new one and publish it in app.php). After entering the provider name, you should specify the type of the registering - bind or singleton.

In the end of the generation process you will have:

- Service class that implements new or existing Interface;
- Registered dependency in new or existing Provider;

### For provider creating:

[](#for-provider-creating)

#### Provider only

[](#provider-only)

You can generate only provider (php file) with :

```
$ php artisan create:provider NameOfTheProvider
```

If you don't specify the name of the provider, Laravel will ask you to type it.

```
$ php artisan create:provider
```

#### Generate or get existing provider and register dependency in it

[](#generate-or-get-existing-provider-and-register-dependency-in-it)

You can generate or get existing provider:

```
$ php artisan create:provider NameOfTheProvider --register
```

or just

```
$ php artisan create:provider --register
```

If you don't specify name, Laravel will ask you for them.

After you type the provider name, Laravel will ask you for the names of service and interface and the type of the registering - bind or singleton.

In the end of the generation process you will have:

- Service class that implements new or existing Interface;
- Registered dependency in new or existing Provider;

Examples of generated files
---------------------------

[](#examples-of-generated-files)

- [Plain service](_documentation/PLAINSERVICE.md);
- [Services with implementation](_documentation/SERVICEIMPEMENTS.md);
- [Interface](_documentation/INTERFACE.md);
- [Provider](_documentation/PROVIDER.md);
- [Changes in app.php](_documentation/APPPHP.md);

Coming soon
-----------

[](#coming-soon)

The next stage will be adding --resource option to create:service and create:interface commands. This will allow you to generate files with resource methods - getAll(), findByKey(Model $model), etc.

License
-------

[](#license)

Laravel Service Generator is open-sourced software licensed under the [MIT license](_documentation/LICENSE.md).

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1509d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/764abc8d62a46601dd04ab3ecb4f3e395a3d113657a15d22a992f724fb5a580d?d=identicon)[Ins0mniac](/maintainers/Ins0mniac)

---

Top Contributors

[![ins0mniac1](https://avatars.githubusercontent.com/u/57196634?v=4)](https://github.com/ins0mniac1 "ins0mniac1 (2 commits)")

### Embed Badge

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

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

PHPackages © 2026

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