xammie / make-commands
laravel 扩展的 make 命令
v0.5.0
2023-02-14 18:47 UTC
Requires
- php: ^8.0
- laravel/framework: ^8.0 || ^9.0 || ^10.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- laravel/pint: ^1.2
- nunomaduro/collision: ^5.10 || ^6.0
- nunomaduro/larastan: ^1.0 || ^2.0
- orchestra/testbench: ^6.22 || ^7.0 || ^8.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-09 12:11:56 UTC
README
此包扩展了默认的laravel make命令,用于创建类似actions、services、enums等类。
php artisan make:action CreateUserAction
这将创建文件 app/Actions/CreateUserAction.php
<?php namespace App\Actions; class CreateUserAction { public function handle() { // } }
安装
您可以通过composer安装此包
composer require --dev xammie/make-commands
您可以使用以下命令发布存根文件
php artisan vendor:publish --tag="make-commands-stubs"
您可以使用以下命令发布配置文件
php artisan vendor:publish --tag="make-commands-config"
这是已发布配置文件的内容
return [ 'namespaces' => [ 'action' => 'Actions', 'collection' => 'Collections', 'config' => 'config', 'contract' => 'Contracts', 'dto' => 'Dtos', 'enum' => 'Enums', 'interface' => 'Interfaces', 'repository' => 'Repositories', 'service' => 'Services', 'trait' => 'Traits', ], ];
用法
以下命令可用。
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
测试
composer test
变更日志
请参阅CHANGELOG了解最近更改的详细信息。
贡献
请参阅CONTRIBUTING以获取详细信息。
安全漏洞
请查阅我们的安全策略了解如何报告安全漏洞。
鸣谢
许可证
MIT许可证(MIT)。请参阅许可证文件获取更多信息。