PHPackages                             codebider/service-generator-tool - 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. [CLI &amp; Console](/categories/cli)
4. /
5. codebider/service-generator-tool

ActiveLibrary[CLI &amp; Console](/categories/cli)

codebider/service-generator-tool
================================

A Laravel package to generate service classes using an Artisan command.

v0.0.1(1y ago)452MITPHPPHP &gt;=7.3

Since Apr 21Pushed 1y ago1 watchersCompare

[ Source](https://github.com/AwaisJ670/serviceGenerator)[ Packagist](https://packagist.org/packages/codebider/service-generator-tool)[ RSS](/packages/codebider-service-generator-tool/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

[![Laravel Service Generator](https://camo.githubusercontent.com/3d700c4709e80afc651cd6dd144390ee38047e616867d5c063f3186e78fa138f/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f5365727669636525323047656e657261746f72253230546f6f6c2e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d636f64656269646572253246736572766963652d67656e657261746f722d746f6f6c267061747465726e3d7a69675a6167267374796c653d7374796c655f31266465736372697074696f6e3d546869732b63616e2b6d616b652b612b736572766963652b696e2b6c61726176656c2b70726f6a656374732e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)](https://camo.githubusercontent.com/3d700c4709e80afc651cd6dd144390ee38047e616867d5c063f3186e78fa138f/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f5365727669636525323047656e657261746f72253230546f6f6c2e706e673f7468656d653d6461726b267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d636f64656269646572253246736572766963652d67656e657261746f722d746f6f6c267061747465726e3d7a69675a6167267374796c653d7374796c655f31266465736372697074696f6e3d546869732b63616e2b6d616b652b612b736572766963652b696e2b6c61726176656c2b70726f6a656374732e266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667)

[![Packagist Downloads](https://camo.githubusercontent.com/c148df1b88b5ad81a0a7a22cd3e7bb85f81cdb638848034596e32ee264993334/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f646562696465722f736572766963652d67656e657261746f722d746f6f6c)](https://camo.githubusercontent.com/c148df1b88b5ad81a0a7a22cd3e7bb85f81cdb638848034596e32ee264993334/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f646562696465722f736572766963652d67656e657261746f722d746f6f6c)[![Packagist Version](https://camo.githubusercontent.com/a947b4c77f15747194daee84c9a0f4ec41b0b380dbe11619ce0708be0ec91d40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f646562696465722f736572766963652d67656e657261746f722d746f6f6c)](https://camo.githubusercontent.com/a947b4c77f15747194daee84c9a0f4ec41b0b380dbe11619ce0708be0ec91d40/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f646562696465722f736572766963652d67656e657261746f722d746f6f6c)

Laravel Service Generator
=========================

[](#laravel-service-generator)

[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

A simple yet powerful Laravel package to generate service classes using an Artisan command.

---

📦 Installation
--------------

[](#-installation)

You can install the package via Composer:

```
composer require codebider/service-generator-tool
```

If you’re using Laravel &lt; 5.5, add the service provider manually in `config/app.php`:

```
'providers' => [
    CodeBider\ServiceGenerator\ServiceGeneratorServiceProvider::class,
];
```

---

⚙️ Configuration (Optional)
---------------------------

[](#️-configuration-optional)

You can publish the config and stub file using:

```
php artisan vendor:publish --provider="CodeBider\ServiceGenerator\ServiceGeneratorServiceProvider"
```

This will publish:

- `config/service-generator.php`
- `stubs/service.stub`

---

🧪 Usage
-------

[](#-usage)

Generate a new service class using:

```
php artisan make:service {name}
php artisan make:service InventoryService
```

This will create the service class in the configured path named as InventoryService (default: `app/Services`).

---

🛠 Configuration Options
-----------------------

[](#-configuration-options)

File: `config/service-generator.php`

```
return [
    'namespace' => 'App\\Services',
    'path' => app_path('Services'),
];
```

---

✏️ Custom Stub
--------------

[](#️-custom-stub)

By default, the package provides a `service.stub` file. You can customize the stub by modifying the published file:

```
/stubs/service.stub

```

The stub supports two variables:

- `{{ namespace }}`
- `{{ class }}`

Example stub:

```
