ibaiicb/laravel-make-action 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ibaiicb/laravel-make-action

最新稳定版本:v1.0.0

Composer 安装命令:

composer require ibaiicb/laravel-make-action

包简介

A Laravel package that adds a make:action Artisan command to generate Action classes following the single responsibility principle.

README 文档

README

Tests PHPStan Latest Version on Packagist PHP Version License

A Laravel package that adds a make:action Artisan command to generate Action classes following the single responsibility principle.

Requirements

  • PHP 8.1+
  • Laravel 10, 11 or 12

Installation

composer require ibaiicb/laravel-make-action

The package registers itself automatically via Laravel's package discovery.

Usage

Basic action

php artisan make:action SendWelcomeEmail

Generates app/Actions/SendWelcomeEmail.php:

<?php

namespace App\Actions;

class SendWelcomeEmail
{
    public function handle(): void
    {
        //
    }
}

Invokable action (--invokable / -i)

php artisan make:action SendWelcomeEmail --invokable

Generates a class with __invoke() instead of handle().

Queued action (--queued / -q)

php artisan make:action SendWelcomeEmail --queued

Generates a class implementing ShouldQueue with all the required queue traits.

With an accompanying test (--test)

php artisan make:action SendWelcomeEmail --test

Generates the action and a Pest test at tests/Feature/Actions/SendWelcomeEmailTest.php.

Nested namespaces

Use / as separator to generate actions in sub-namespaces:

php artisan make:action Auth/LoginUser
# → app/Actions/Auth/LoginUser.php  (namespace App\Actions\Auth)

php artisan make:action Billing/Subscription/CancelSubscription
# → app/Actions/Billing/Subscription/CancelSubscription.php

Overwrite an existing action (--force)

php artisan make:action SendWelcomeEmail --force

Configuration

Publish the config file to customise the default namespace and method name:

php artisan vendor:publish --tag=laravel-make-action-config

config/make-action.php:

return [
    'namespace' => 'Actions',   // generates under App\Actions
    'method'    => 'handle',    // main method name (ignored for --invokable)
];

Customising stubs

Publish the stubs to tailor the generated code:

php artisan vendor:publish --tag=laravel-make-action-stubs

This copies the stubs to stubs/vendor/laravel-make-action/. The command will use your published stubs automatically.

Testing

composer test

Changelog

Please see CHANGELOG.md for recent changes.

Contributing

Please see CONTRIBUTING.md for details.

Security

Please see SECURITY.md for how to report vulnerabilities.

License

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

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固