imalirezapy/laravel-more-command
Composer 安装命令:
composer require imalirezapy/laravel-more-command
包简介
Create a Repository, Service, trait and Strategy using Artisan CLI
README 文档
README
Laravel More Command
Laravel More Command is a collection of a few php artisan commands. You can use it to create a Repository, Repository with Interface, Service, Trait, View(blade file), and Clear Log from the command line using php artisan command.
[Note : This package also worked for nWidart/laravel-modules]
Installation
Require the package with composer using the following command:
composer require imalirezapy/laravel-more-command --dev
Or add the following to your composer.json's require-dev section and composer update
"require-dev": { "imalirezapy/laravel-more-command": "^1.0.0" }
Publish Package Configuration
php artisan vendor:publish --provider="imalirezapy\LaravelMoreCommand\LaravelMoreCommandProvider" --tag="config"
To Change Default Namespace [config/laravel-more-command.php]
<?php return [ 'repository-namespace' => 'App', // Your Desire Namespace for Repository Classes 'service-namespace' => 'App', // Your Desire Namespace for Service Classes ];
Artisan Command List
Make Repository
Create a repository Class.
php artisan make:repository your-repository-name
Example:
php artisan make:repository UserRepository
or
php artisan make:repository Backend/UserRepository
The above will create a Repositories directory inside the App directory.\
Create a repository with Interface.
php artisan make:repository your-repository-name -i
Example:
php artisan make:repository UserRepository -i
or
php artisan make:repository Backend/UserRepository -i
Here you need to put extra -i flag.
The above will create a Repositories directory inside the App directory.
In nWidart/laravel-modules Modules
Create a repository Class.
php artisan module:make-repository your-repository-name {module-name}
Example:
php artisan module:make-repository UserRepository Blog
or
php artisan module:make-repository Backend/UserRepository Blog
The above will create a Repositories directory inside the {Module} directory.
Create a repository with Interface.
php artisan module:make-repository your-repository-name {module-name} -i
Example:
php artisan module:make-repository UserRepository -i Blog
or
php artisan module:make-repository Backend/UserRepository -i Blog
Here you need to put extra -i flag.
The above will create a Repositories directory inside the {Module} directory.
\
An Example of created repository class:
<?php
namespace App\Repositories;
class UserRepository
{
public function __constuct()
{
//
}
}
Make Strategy
signature: make:strategy {context} {--s|strategy=*} {--i|interface}
Create a context Class.
php artisan make:stratey context-name
Example:
php artisan make:strategy PaymentContext
or
php artisan make:repository Pay/PaymentContext
The above will create a PaymentContext/Pay directory inside the app/Services directory.\
Create a strategies classes.
php artisan make:strategy context-name {--s|strategy=*} (multiple values allowed)
Example:
php artisan make:strategy PaymentContext -sOnlinePayment -sOfflinePayment
or
php artisan make:strategy PaymentContext --strategy=OnlinePayment --strategy=OfflinePayment
Create a strategy with Interface.
php artisan make:strategy context-name -i
Example:
php artisan make:repository PaymentContext -i
or
php artisan make:repository Pay/PaymentContext -i
Here you need to put extra -i or --interface flag.
Make Service
Create a Service Class.
php artisan make:service your-service-name
Example:
php artisan make:service UserService
or
php artisan make:service Backend/UserService
The above will create a Services directory inside the App directory.
In nWidart/laravel-modules Modules
php artisan module:make-service your-service-name {module-name}
Example:
php artisan module:make-service UserService
or
php artisan module:make-service Backend/UserService
The above will create a Services directory inside the {Module} directory.
Make Trait
Create a Trait.
php artisan make:trait your-trait-name
Example:
php artisan make:trait HasAuth
or
php artisan make:trait Backend/HasAuth
The above will create a Traits directory inside the App directory.
In nWidart/laravel-modules Modules
php artisan module:make-trait your-trait-name {module-name}
Example:
php artisan module:make-trait HasAuth
or
php artisan module:make-trait Backend/HasAuth
The above will create a Traits directory inside the {Module} directory.
Make View
Create a view.
php artisan make:view your-view-file-name
Example:
php artisan make:view index
or
php artisan make:view user/index
The above will create a blade file inside the /resource/views/ directory.
In nWidart/laravel-modules Modules
php artisan module:make-view your-view-file-name {module-name}
Example:
php artisan module:make-view index
or
php artisan module:make-view user/index
The above will create a blade file inside the {Module}/Resources/views/ directory.
Log Clear
php artisan log:clear
The above will deleted all old log data from /storage/logs/ directory.
License
The MIT License (MIT). Please see License for more information.
imalirezapy/laravel-more-command 适用场景与选型建议
imalirezapy/laravel-more-command 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 05 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 imalirezapy/laravel-more-command 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 imalirezapy/laravel-more-command 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-05-02