mmt/laravel-feature-scaffold

Artisan commands to scaffold Laravel feature structure (make:feature, make:feature-model, make:feature-job, etc.)

Maintainers

Package info

github.com/TitanDvd/laravel-feature-scaffold

pkg:composer/mmt/laravel-feature-scaffold

Statistics

Installs: 20

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.2.0 2026-03-24 10:25 UTC

This package is auto-updated.

Last update: 2026-03-24 10:26:01 UTC


README

Artisan commands to scaffold a feature-based directory structure for Laravel applications, following the pattern used in app/Features/Events.

Installation

composer require mmt/laravel-feature-scaffold

This installs the package and its dependency mmt/api-response-normalizer. Generated controllers use the ApiResponse trait for consistent JSON responses. Laravel auto-discovers the service provider; the Artisan commands are available after composer install or composer update.

To upgrade to the latest version:

composer update mmt/laravel-feature-scaffold

Requirements

  • PHP ^8.2
  • Laravel ^11.0 or ^12.0
  • Illuminate Support ^11.0 or ^12.0

Commands

make:feature

Creates the directory structure for a new feature under app/Features/{Name}/.

Usage:

# Create only the directory structure
php artisan make:feature Events

# Create directories and generate stub files (model, repository contract, use case, command, request, controller, enum)
php artisan make:feature Events -f
# or
php artisan make:feature Events --files

Directories created:

  • Console
  • Enums
  • Events
  • Factories
  • Http/V1/Commands
  • Http/V1/Controllers
  • Http/V1/Requests
  • Jobs
  • Listeners
  • Models
  • Repositories/Contracts
  • Services
  • UseCases

With -f / --files, the command also generates placeholder classes (e.g. EventLog, StoreEventCommand, EventIngestController) that you can customize.

make:feature-model

Creates an Eloquent model inside an existing feature.

Usage:

php artisan make:feature-model Event/EventLog
php artisan make:feature-model Events/NotificationLog

The feature (e.g. Event or Events) must already exist. The model is created at app/Features/{Feature}/Models/{ModelName}.php.

make:feature-job

Creates a queued job class inside an existing feature. If the feature does not have Jobs, Events, or Listeners directories, they are created.

Usage:

php artisan make:feature-job Messaging/ProcessJourneyStep
php artisan make:feature-job Events/SendEventNotification

The job is created at app/Features/{Feature}/Jobs/{JobName}.php and implements ShouldQueue with the Queueable trait.

make:feature-command

Creates an Artisan console command inside an existing feature (Features/FeatureName/Console). The command signature is generated as {feature-kebab}:{command-kebab} (e.g. Messaging/ProcessJourneyStepmessaging:process-journey-step).

Usage:

php artisan make:feature-command Messaging/ProcessJourneyStep
php artisan make:feature-command Events/SendDigest

The class is created at app/Features/{Feature}/Console/{CommandName}.php. Register the feature's Console directory in your app (e.g. bootstrap/app.php or a service provider) so Laravel loads these commands.

make:feature-event

Creates an event class inside an existing feature (Features/FeatureName/Events).

Usage:

php artisan make:feature-event Messaging/JourneyCompleted
php artisan make:feature-event Events/EventRecorded

The event is created at app/Features/{Feature}/Events/{EventName}.php with Dispatchable and SerializesModels.

make:feature-listener

Creates a queued event listener inside an existing feature (Features/FeatureName/Listeners).

Usage:

php artisan make:feature-listener Messaging/SendJourneyNotification
php artisan make:feature-listener Events/LogEvent

The listener is created at app/Features/{Feature}/Listeners/{ListenerName}.php, implements ShouldQueue, and has a handle(object $event) method.

make:feature-service

Creates a service class inside an existing feature (Features/FeatureName/Services).

Usage:

php artisan make:feature-service Messaging/SegmentEvaluatorService
php artisan make:feature-service Events/EventIngestService

The service is created at app/Features/{Feature}/Services/{ServiceName}.php as a plain class in the Services namespace.

Installation options

Via Packagist (recommended)

Use the command at the top of this README. No need to register the provider manually.

Local / development (PSR-4 only)

If you use the package from a local path (e.g. packages/mmt/laravel-feature-scaffold) without adding it as a Composer dependency, auto-discovery does not run. You must:

  1. Autoload – In your Laravel project composer.json, add the package path to autoload.psr-4:

    "autoload": {
        "psr-4": {
            "MMT\\LaravelFeatureScaffold\\": "packages/mmt/laravel-feature-scaffold/src/"
        }
    }
  2. Register the service provider – Add it in bootstrap/providers.php (create the file if it does not exist):

    <?php
    
    return [
        \MMT\LaravelFeatureScaffold\LaravelFeatureScaffoldServiceProvider::class,
    ];
  3. Regenerate autoload:

    composer dump-autoload

The commands make:feature, make:feature-model, make:feature-job, make:feature-command, make:feature-event, make:feature-listener, and make:feature-service will then be available.

Package structure

packages/mmt/laravel-feature-scaffold/
├── composer.json
├── README.md
└── src/
    ├── LaravelFeatureScaffoldServiceProvider.php
    ├── Exceptions/
    │   └── MmtException.php
    ├── Console/
    │   ├── MakeFeatureCommand.php
    │   ├── MakeFeatureModelCommand.php
    │   ├── MakeFeatureJobCommand.php
    │   ├── MakeFeatureArtisanCommand.php
    │   ├── MakeFeatureEventCommand.php
    │   ├── MakeFeatureListenerCommand.php
    │   └── MakeFeatureServiceCommand.php
    └── Stubs/
        ├── console-command.stub
        ├── event.stub
        ├── listener.stub
        ├── service.stub
        ├── job.stub
        ├── model.stub
        ├── repository-contract.stub
        ├── use-case.stub
        ├── command.stub
        ├── request.stub
        ├── controller.stub
        └── enum.stub

License

MIT