Skip to content

Xammie/make-commands

Repository files navigation

Extended make commands for laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package extends the default laravel make commands to create classes like actions, services, enums and more.

php artisan make:action CreateUserAction

This will create the file app/Actions/CreateUserAction.php

<?php

namespace App\Actions;

class CreateUserAction
{
    public function handle()
    {
        //
    }
}

Installation

You can install the package via composer:

composer require --dev xammie/make-commands

You can publish the stubs with:

php artisan vendor:publish --tag="make-commands-stubs"

You can publish the config file with:

php artisan vendor:publish --tag="make-commands-config"

This is the contents of the published config file:

return [
    'namespaces' => [
        'action' => 'Actions',
        'collection' => 'Collections',
        'config' => 'config',
        'contract' => 'Contracts',
        'dto' => 'Dtos',
        'enum' => 'Enums',
        'interface' => 'Interfaces',
        'repository' => 'Repositories',
        'service' => 'Services',
        'trait' => 'Traits',
    ],
];

Usage

The following commands are available.

php artisan make:action CreateUserAction
php artisan make:collection OrderCollection
php artisan make:config config-file
php artisan make:contract CreatesUserContract
php artisan make:dto RestRequestObject
php artisan make:enum OrderStatusEnum
php artisan make:interface OrderRepositoryInterface
php artisan make:repository OrderRepository
php artisan make:service PaymentService
php artisan make:trait TraitHelper

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.