adereksisusanto/laravel-artisan

Laravel scaffolding toolkit – generate boilerplate code and build artisan-powered CLI tools.

Maintainers

Package info

github.com/adereksisusanto/laravel-artisan

pkg:composer/adereksisusanto/laravel-artisan

Transparency log

Fund package maintenance!

adereksisusanto

Statistics

Installs: 889

Dependents: 0

Suggesters: 0

Stars: 5

Open Issues: 0

v1.0.8 2026-07-07 10:05 UTC

This package is auto-updated.

Last update: 2026-07-12 19:35:06 UTC


README

Tests PHPStan Packagist Version Packagist Downloads PHP Version License

Artisan commands to scaffold boilerplate code — designed for Laravel package developers.

Note: This package runs standalone — it does not integrate with a Laravel application. Perfect for package development where you need artisan scaffolding without booting a full Laravel app.

Languages: Indonesia | English

Installation

composer require adereksisusanto/laravel-artisan --dev

After installation, the bin/artisan entry point is available in your project's vendor/bin directory.

Setup artisan file

Copy the artisan binary to your project root:

cp vendor/bin/artisan artisan

Or create artisan manually in your project root:

#!/usr/bin/env php
<?php

require __DIR__ . '/vendor/autoload.php';

use Adereksisusanto\Laravel\Artisan\Application;
use Adereksisusanto\Laravel\Artisan\Kernel;

$app = Application::create(__DIR__);

$kernel = new Kernel($app);
$status = $kernel->handle();
$kernel->terminate($status);

Then run:

php artisan list

You can also use it directly without copying:

php vendor/bin/artisan list

Quick Start

After setting up the artisan file, run:

php artisan list

Namespace and source path are automatically read from your project's composer.json PSR-4 autoload — no additional configuration needed.

Custom Paths

You can override the default output directory for any generator via composer.json:

{
    "extra": {
        "laravel-artisan": {
            "paths": {
                "model": "Models",
                "enum": "Enums",
                "interface": "Contracts",
                "factory": "Database/Factories",
                "migration": "Database/Migrations",
                "seeder": "Database/Seeders",
                "request": "Http/Requests",
                "middleware": "Http/Middleware",
                "resource": "Http/Resources",
                "component": "View/Components",
                "controller": "Http/Controllers",
                "action": "Actions",
                "service": "Services",
                "repository": "Repositories",
                "dto": "DTOs",
                "trait": "Traits",
                "job": "Jobs",
                "event": "Events",
                "listener": "Listeners",
                "mail": "Mail",
                "notification": "Notifications",
                "rule": "Rules",
                "scope": "Scopes",
                "observer": "Observers",
                "pipeline": "Pipelines",
                "policy": "Policies",
                "provider": "Providers",
                "facade": "Facades",
                "exception": "Exceptions",
                "cast": "Casts",
                "command": "Commands",
                "channel": "Broadcasting",
                "config": "config",
                "lang": "lang",
                "routes": "routes"
            }
        }
    }
}

Only set the keys you want to customize; others will use the default directory.

Available Commands

Command Description
make:action <name> Generate an action class
make:cast <name> Generate a custom Eloquent cast class
make:channel <name> Generate a broadcast channel class
make:command <name> Generate a new artisan command
make:component <name> Generate a view component class
make:config <name> Generate a configuration file
make:controller <name> Generate a controller class
make:dto <name> Generate a DTO class
make:enum <name> Generate an enum class
make:event <name> Generate an event class
make:exception <name> Generate an exception class
make:facade <name> Generate a facade class
make:interface <name> Generate an interface
make:factory <name> Generate a model factory class
make:job <name> Generate a queued job class
make:lang <name> Generate a language file
make:listener <name> Generate an event listener class
make:mail <name> Generate a mailable class
make:middleware <name> Generate a middleware class
make:migration <name> Generate a migration file
make:model <name> Generate an Eloquent model class
make:notification <name> Generate a notification class
make:observer <name> Generate an observer class
make:pipeline <name> Generate a pipeline class
make:policy <name> Generate a policy class
make:provider <name> Generate a service provider class
make:repository <name> Generate a repository class
make:request <name> Generate a form request class
make:resource <name> Generate an API resource class
make:routes <name> Generate a routes file
make:rule <name> Generate a validation rule class
make:scope <name> Generate a query scope class
make:seeder <name> Generate a seeder class
make:service <name> Generate a service class
make:trait <name> Generate a trait
make:view <name> Generate a Blade view file
app:build <name> Build a PHAR archive
app:inspect Inspect application details

Options

Every make:* command supports --force to overwrite existing files.

Command Options
make:action --force
make:cast --force
make:channel --force
make:command --command= (terminal command name), --force
make:component --force
make:config --force
make:controller -i, --invokable, -m, --model=, -r, --resource, --api, -R, --requests, --force
make:dto --force
make:enum --force
make:event --force
make:exception --force
make:facade --force
make:factory -m, --model=, --force
make:interface --force
make:job --sync (synchronous), --force
make:lang --locale= (default: en), --force
make:listener -e, --event=, --queued, --force
make:mail --markdown=, --force
make:middleware --force
make:migration --create= (table to create), --table= (table to modify), --path=, --force
make:model -a, --all, -c, --controller, -f, --factory, -m, --migration, --policy, -s, --seed, -r, --resource, --api, -R, --requests, --force
make:notification --markdown=, --force
make:observer -m, --model=, --force
make:pipeline --force
make:policy -m, --model=, --guard=, --force
make:provider --force
make:repository --force
make:request --force
make:resource -m, --model=, -c, --collection, --force
make:routes --force
make:rule --implicit, --force
make:scope --force
make:seeder --force
make:service --force
make:trait --force
make:view --force

Custom Stubs

You can customize the generated code by publishing and modifying stubs:

php artisan stubs:publish

This copies all stub files to stubs/vendor/laravel-artisan/. Edit any stub and subsequent make:* commands will use your version instead of the built-in one.

Use --force to overwrite previously published stubs:

php artisan stubs:publish --force

Registering Custom Commands

Register individual or multiple commands directly to the kernel:

use Adereksisusanto\Laravel\Artisan\Kernel;

$kernel = new Kernel($app);

$kernel->registerCommand(\App\Commands\MyCommand::class);
$kernel->registerCommands([
    \App\Commands\FooCommand::class,
    \App\Commands\BarCommand::class,
]);

$kernel->handle();

Registering Service Providers

For packages that register commands or bindings via a service provider:

// Single provider
$app->registerServiceProvider(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);

// Multiple providers
$app->registerServiceProviders([
    \Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
    \App\Providers\SomeServiceProvider::class,
]);

$kernel = new Kernel($app);
$status = $kernel->handle();

Build PHAR

php artisan app:build myapp
./myapp list

Contributing

  1. Fork & clone

    git clone https://github.com/<your-username>/laravel-artisan.git
    cd laravel-artisan
  2. Install dependencies

    composer install
  3. Create a branch

    git checkout -b feat/your-feature-name
  4. Make changes & run quality checks

    composer check

    This runs Pint (style), PHPStan (static analysis), and Pest (tests).

  5. Run tests for all supported Laravel versions (optional, requires Docker)

    # Test against Laravel 11
    composer require laravel/framework:^11.0 orchestra/testbench:^9.0 --no-update --dev && composer update --prefer-stable && composer test
    
    # Test against Laravel 12
    composer require laravel/framework:^12.0 orchestra/testbench:^10.0 --no-update --dev && composer update --prefer-stable && composer test
    
    # Test against Laravel 13
    composer require laravel/framework:^13.0 orchestra/testbench:^11.0 --no-update --dev && composer update --prefer-stable && composer test
  6. Commit & push

    git add .
    git commit -m "feat: add your feature"
    git push origin feat/your-feature-name
  7. Open a pull request on GitHub

Contributors

All Contributors

Thanks goes to these wonderful people:

Ade Reksi Susanto
Ade Reksi Susanto

Contributions are welcome! Please open an issue or pull request.