定制 vkovic/laravel-commando 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

vkovic/laravel-commando

Composer 安装命令:

composer require vkovic/laravel-commando

包简介

Collection of handy Laravel artisan commands that most projects needs

README 文档

README

Build Downloads Stable License

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:dump which uses mysqldump), 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
Database related

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 list command from laravel-commando package

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:

  • model optional: 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 model fields command from laravel-commando package

php artisan db:exist <database>

Check if database exists

Arguments:
  • database optional: Database name to check. If omitted it'll check for default db (defined in .env).

Usage example

php artisan db exists command from laravel-commando package

php artisan db:create <database>

Create database

Arguments:

  • database optional: Database to create. If omitted, name from .env will be used.

Usage example

php artisan db create command from laravel-commando package

php artisan db:drop <database>

Drop database

Arguments:

  • database optional: Database to drop. If omitted, name from .env will be used

Usage example

php artisan db drop command from laravel-commando package

php artisan db:dump <database> <--dir>

Dump database to .sql file

Arguments:

  • database optional: Database to dump. If omitted, name from .env will be used.

Options:

  • --dir: Directory for dump creation. If omitted default filesystem dir will be used.

Usage example

php artisan db dump command from laravel-commando package

php artisan db:import-dump <database> <--dir>

Import dump from .sql file

Arguments:

  • database optional: Database to import dump to. If omitted, name from .env will be used.

Options:

  • --dir: Directory for dump lookup. If omitted default filesystem dir will be used.

Usage example

php artisan db import dump command from laravel-commando package

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

php artisan db summon command from laravel-commando package

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 我们能提供哪些服务?
定制开发 / 二次开发

基于 vkovic/laravel-commando 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 61
  • Watchers: 1
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-03