smonteromx/useful-artisan-commands 问题修复 & 功能扩展

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

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

smonteromx/useful-artisan-commands

Composer 安装命令:

composer require smonteromx/useful-artisan-commands

包简介

A collection of useful Laravel Artisan commands for generating actions, DTOs, and more.

README 文档

README

A collection of handy Laravel Artisan commands for generating actions, DTOs, and configuring databases.

Requires PHP 8.2+ and Laravel 12 or 13.

Installation

composer require smonteromx/useful-artisan-commands --dev

Auto-discovery registers the commands automatically.

Automatic PostgreSQL Verification

When the package is installed, it automatically listens for migrate* Artisan commands. For PostgreSQL connections, it verifies that:

  • the configured database exists, creating it through a maintenance postgres connection when possible
  • the configured migrations schema exists when database.migrations.table uses schema.table notation

This requires no application service provider setup while Laravel package auto-discovery is enabled. The verification also runs eagerly during unit tests so migration-backed test databases can be prepared before the test suite touches the connection.

If package discovery is disabled for this package, manually register SMonteroMx\UsefulArtisanCommands\UsefulArtisanCommandsServiceProvider in bootstrap/providers.php.

Commands

make:action

Generates an action class in app/Actions/. The Action suffix is auto-appended.

php artisan make:action CreateUser
# -> app/Actions/CreateUserAction.php

php artisan make:action Billing/ChargeInvoice
# -> app/Actions/Billing/ChargeInvoiceAction.php
Option Description
-d, --data Also generate a matching DTO class
-f, --force Overwrite if file already exists

make:data

Generates a final readonly DTO class in app/Data/. The Data suffix is auto-appended.

php artisan make:data CreateUser
# -> app/Data/CreateUserData.php
Option Description
-f, --force Overwrite if file already exists

app:config-db

Interactive prompt to configure PostgreSQL connection details in your .env file.

php artisan app:config-db

Prompts for host, port, database name, username, and password. Before saving, it shows a review table and lets you correct selected fields.

Customizing Stubs

Publish the stubs to customize the generated file templates:

php artisan vendor:publish --tag=useful-artisan-commands-stubs

This copies action.stub and data.stub to your project's stubs/ directory. The commands will use your local stubs over the package defaults.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

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