opheus2/laravel-makeclass
最新稳定版本:v1.0.0
Composer 安装命令:
composer require opheus2/laravel-makeclass
包简介
A laravel package that makes the creating of php classes faster
README 文档
README
Features
- Create a php class from the command for any directory in the root name-space;
- Store a custom path as an alias and use alias instead of full path.
- Create interface | class | enum | trait.
- Create final and abstract classes
- Create class with a declare strict_type
Installation
composer require opheus2/laravel-makeclass
###Usages
File is created in root name-space. E.b App
php artisan make:class {name}
Default type is class.
File is created in test folder in root name-space. E.b App/Test
php artisan make:class Test\{name}
Create an interface type of class
php artisan make:class {name} -i
or
php artisan make:class {name} --type interface
| Available types | flags |
|---|---|
| class | (default no flag) |
| interface | (-i or --interface) |
| trait | (-T or --trait) |
| enum | (-e or --enum) |
Using custom path with alias
php artisan make:class {name} -i -p="Domains/Services/" --alias="ape"
or
php artisan make:class {name} -i -p=Domain\Services\ --alias=ape
or
php artisan make:class {name} -i -p Domain\Services\ --alias ape
Please note: You always need to add a trailing slash at the end for it to work properly. I would surely fix that soon.
Then you can use alias as path
php artisan make:class {name} -i -p="ape"
This would use the same old/saved path for subsequent file names
Using modifiers
php artisan make:class {name} -fx
This would create a final class with declare strict_types at the top You can use the -x flag to always add the strict type to any class type
| Available modifiers | flags |
|---|---|
| strict | (-x or --strict) |
| final | (-f or --final) |
| abstract | (-a or --abstract) |
For more info you can do
php artisan make:class --help
####Thank you
###TODO
- Add check for trailing slash and auto fix
统计信息
- 总下载量: 891
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-01-09