vkovic/laravel-commando
Composer 安装命令:
composer require vkovic/laravel-commando
包简介
Collection of handy Laravel artisan commands that most projects needs
README 文档
README
Collection of handy Laravel artisan commands that most projects needs
Handy artisan commands that may find place in most of the Laravel projects regardless of the project type.
How often you wanted to perform some basic tasks like create or drop database, dump database or load from .sql dump, or to see which fields (and field types) are present in your models? Continue reading and I promise to easy this, and many more tasks to you 🍻
Compatibility
The package is compatible with Laravel versions 5.5, 5.6, 5.7, 5.8, 6.x, 7.x and 8.x.
Because some commands rely on raw console commands (like
db:dumpwhich usesmysqldump), currently only MySql database and Linux environments are supported. Package is designed to easily support multiple OS-es and database types, and it should be easy implementation, so if anyone is interested to help, please feel free to contribute.
Installation
Install the package via composer:
If your're using Laravel 8, run:
composer require vkovic/laravel-commando
If your're using Laravel prior version 8, run:
composer require vkovic/laravel-commando "^0.1"
Available commands
Package is in early stage so there is limited number of commands. I'm planning to add more, so if you have some suggestion you can require feature via issues page (click on
Issues -> New issue -> Feature request)
Model related
- model:list ~ List all application
Modelsand related info - model:fields ~ Show single
Modeland useful info
Database related
- db:exist ~ Check for database existance
- db:create ~ Create database
- db:drop ~ Easily drop default or another db
- db:dump ~ Dump database to
.sqlfile - db:import-dump ~ Import db from exported
.sql - db:summon ~ create/drop | migrate | seed
php artisan model:list
Show all models and some basic info.
- Model (model class)
- Table (table used by the model)
- Table count (count of all records in the model related table)
- Scope count (count of records with all scopes applied:
$n = SomeModel::count() - Soft deleted (show how many soft deleted items model have)
Usage example

php artisan model:fields <model>
Show model fields info.
- Field (model field / table column)
- Type (db field type)
- Nullable (db value can be null)
- Default (default db value)
- Casts (attribute muttators)
- Guarded (field is not mass assignable)
- Fillable (field is mass assignable)
Arguments:
modeloptional: Model to show fields from (e.g."App\User"). If omitted, list of all models will be shown to choose from.
Usage example
php artisan db:exist <database>
Check if database exists
Arguments:
databaseoptional: Database name to check. If omitted it'll check for default db (defined in.env).
Usage example

php artisan db:create <database>
Create database
Arguments:
databaseoptional: Database to create. If omitted, name from.envwill be used.
Usage example

php artisan db:drop <database>
Drop database
Arguments:
databaseoptional: Database to drop. If omitted, name from.envwill be used
Usage example

php artisan db:dump <database> <--dir>
Dump database to .sql file
Arguments:
databaseoptional: Database to dump. If omitted, name from.envwill be used.
Options:
--dir: Directory for dump creation. If omitted default filesystem dir will be used.
Usage example

php artisan db:import-dump <database> <--dir>
Import dump from .sql file
Arguments:
databaseoptional: Database to import dump to. If omitted, name from.envwill be used.
Options:
--dir: Directory for dump lookup. If omitted default filesystem dir will be used.
Usage example

php artisan db:summon
Drop default database, than perform migrate followed with the seed.
Useful in early stages of development when we changing models (migrations and seeds) a lot.
Usage example

Contributing
If you plan to modify this Laravel package you should run tests that comes with it.
Easiest way to accomplish this would be with Docker, docker-compose and phpunit.
First, we need to initialize Docker containers (see docker-composer.yaml for details).
docker-compose up --exit-code-from app
After that, we can run tests and watch the output:
docker-compose run --rm app phpunit
vkovic/laravel-commando 适用场景与选型建议
vkovic/laravel-commando 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 41.94k 次下载、GitHub Stars 达 61, 最近一次更新时间为 2019 年 07 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「console」 「commands」 「laravel」 「artisan」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 vkovic/laravel-commando 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vkovic/laravel-commando 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 vkovic/laravel-commando 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This class provides you with an easy-to-use interface to progress bars.
A Laravel package to retrieve data from Google Search Console
Additional artisan commands for Laravel
This Package provides some usefully console features like the attribute syntax for arguments and options, validation, auto ask and casting.
The Missing Laravel Artisan Commands
A table generator class for the PHP CLI.
统计信息
- 总下载量: 41.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 61
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-03
