kerigard/laravel-commands
最新稳定版本:v1.1.0
Composer 安装命令:
composer require kerigard/laravel-commands
包简介
Commands for Laravel
关键字:
README 文档
README
Commands for Laravel 10 and up.
Installation
Install package via composer:
composer require kerigard/laravel-commands
Publish the configuration file using the vendor:publish artisan command to configure or disable unnecessary commands:
php artisan vendor:publish --provider="Kerigard\LaravelCommands\CommandsServiceProvider" --tag=commands-config
Publish the stubs files using the vendor:publish artisan command to change the structure of generated classes:
php artisan vendor:publish --provider="Kerigard\LaravelCommands\CommandsServiceProvider" --tag=commands-stubs
Usage
Pint
Running Laravel Pint via artisan command.
pint [options] [--] [<paths>...]
| Argument | Description |
|---|---|
| paths | Run Pint on specific files or directories |
| Option | Shortcut | Description |
|---|---|---|
| --verbose | -v | Show details of changes |
| --test | -t | Inspect code for style errors without actually changing the files |
| --dirty | -d | Modify the files that have uncommitted changes according to Git |
| --preset[=PRESET] | -p | Use preset with rule set to fix code |
| --config[=CONFIG] | -c | Use pint.json config from a specific directory |
Examples
Run Laravel Pint.
php artisan pint
Run with arguments:
php artisan pint app/Models routes/api.php -t --preset psr12 --config vendor/my-company/coding-style/pint.json
Make Enum
Create a new enum class.
make:enum [options] [--] <name>
| Argument | Description |
|---|---|
| name | The name of the enum |
| Option | Shortcut | Description |
|---|---|---|
| --force | -f | Create the class even if the enum already exists |
| --help | -h | Display help for the given command |
Examples
Create a enum class:
php artisan make:enum Status
Creates a file
app/Enums/Status.php.
Make Trait
Create a new trait class.
make:trait [options] [--] <name>
| Argument | Description |
|---|---|
| name | The name of the trait |
| Option | Shortcut | Description |
|---|---|---|
| --force | -f | Create the class even if the trait already exists |
| --help | -h | Display help for the given command |
Examples
Create a trait class:
php artisan make:trait HasRoles
Creates a file
app/Traits/HasRoles.php.
Make Contract
Create a new contract interface.
make:contract [options] [--] <name>
| Argument | Description |
|---|---|
| name | The name of the contract |
| Option | Shortcut | Description |
|---|---|---|
| --action | -a | Create a contract for an action |
| --force | -f | Create the interface even if the contract already exists |
| --help | -h | Display help for the given command |
Examples
Create a contract interface:
php artisan make:contract CreatesUser
Creates a file
app/Contracts/CreatesUser.php.
Create a contract for action:
php artisan make:contract CreatesUser --action
Creates a file
app/Contracts/CreatesUser.php.
Make Action
Create a new action class.
make:action [options] [--] <name>
| Argument | Description |
|---|---|
| name | The name of the action |
| Option | Shortcut | Description |
|---|---|---|
| --contract[=CONTRACT] | -c | Create a new contract for the action |
| --force | -f | Create the class even if the action already exists |
| --help | -h | Display help for the given command |
Examples
Create a action class:
php artisan make:action CreateUser
Creates a file
app/Actions/CreateUser.php.
Create action and contract:
php artisan make:action CreateUser --contract CreatesUser
Creates
app/Actions/CreateUser.phpandapp/Contracts/CreatesUser.phpfiles.
Create action and contract with the same name:
php artisan make:action CreateUser --contract
Creates
app/Actions/CreateUser.phpandapp/Contracts/CreateUser.phpfiles.
Make Service
Create a new service class.
make:service [options] [--] <name>
| Argument | Description |
|---|---|
| name | The name of the service |
| Option | Shortcut | Description |
|---|---|---|
| --contract[=CONTRACT] | -c | Create a new contract for the service |
| --force | -f | Create the class even if the service already exists |
| --help | -h | Display help for the given command |
Examples
Create a service class:
php artisan make:service UserService
Creates a file
app/Services/UserService.php.
Create service and contract:
php artisan make:service UserService --contract User
Creates
app/Services/UserService.phpandapp/Contracts/User.phpfiles.
Create service and contract with the same name:
php artisan make:service UserService --contract
Creates
app/Services/UserService.phpandapp/Contracts/UserService.phpfiles.
Changelog
Please see the CHANGELOG for more information on what has changed recently.
License
MIT. Please see the LICENSE FILE for more information.
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-03-18