PHPackages                             usmanzahid/laravel-custom-make - 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. usmanzahid/laravel-custom-make

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

usmanzahid/laravel-custom-make
==============================

A Laravel package to generate any kind of file using custom stubs and configuration.

v1.1.1(1y ago)140MITPHPPHP ^8.3|^8.2|^8.1|^8.0

Since Apr 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Usmanzahidcode/laravel-custom-make)[ Packagist](https://packagist.org/packages/usmanzahid/laravel-custom-make)[ RSS](/packages/usmanzahid-laravel-custom-make/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (10)Used By (0)

Laravel Custom Make
===================

[](#laravel-custom-make)

A Laravel package to generate custom classes using user-defined stub templates and configurable paths. You can define custom make types to use with the make command.

---

### Installation

[](#installation)

```
composer require usmanzahid/laravel-custom-make
```

### Publishing Configuration &amp; Stubs

[](#publishing-configuration--stubs)

After installing, publish the configuration file and default stubs using:

```
php artisan vendor:publish --tag=config
php artisan vendor:publish --tag=stubs
```

This will:

- Create a `config/laravel-custom-make.php` config file.
- Publish stub files to the root `stubs/` directory.

### Configuration

[](#configuration)

Open config/laravel-custom-make.php to define your custom make types. Example for services:

```
return [
    'service' => [
        'path' => app_path('Services'),
        'stub' => base_path('stubs/service.stub'),
    ],
];
```

You can define as many types as needed. Each type must include:

- path: Where the class will be generated.
- stub: The stub template used for that type.

### Usage

[](#usage)

Run the command:

```
php artisan make:custom {type} {Name}
```

Example:

```
php artisan make:custom service AuthService
```

This will generate `app/Services/AuthService.php` using the corresponding stub.

### Use Cases

[](#use-cases)

This package is ideal for:

- Adding new custom generators like Services, DTOs, Repositories, etc.
- Generating custom class types the artisan way.
- Replacing or extending Laravel's default generators.
- Creating advanced stubs with pre-defined methods, fields, or logic.

For example, you can:

- Define a custom controller.stub with commonly used methods like index, store, etc.
- Create a model.stub with predefined $fillable fields, relationships, or traits.
- Scaffold layered structures using personalized templates.

### Stub File Format

[](#stub-file-format)

Your stub file should include placeholders like:

```
