sabatino/artisan-dev
Composer 安装命令:
composer require sabatino/artisan-dev
包简介
Helper for running multiple dev scripts in Laravel
README 文档
README
Run multiple scripts in parallel from a single command, with integrated logging.
Installation
composer require sabatino/artisan-dev
This package publishes a dev-scripts config file:
php artisan vendor:publish --tag=dev-services
Configuration
Define your scripts in the dev-scripts.php config file, eg:
<?php return [ 'scripts' => [ 'horizon' => [ 'command' => ['php', 'artisan', 'horizon'], 'style' => ['cyan', null, ['bold']], 'logging' => true, 'log_options' => [ 'apply_style_to_full_line' => true ], 'restart' => [ 'logging' => true, 'watch' => [ '.env', 'app/Jobs/*' ] ] ], 'reverb' => [ 'command' => ['php', 'artisan', 'reverb:start', '--verbose', '--debug'], 'style' => ['magenta', null, ['bold']], 'logging' => true, ], ] ];
Usage
Run the scripts with the php artisan dev command:
php artisan dev
File watcher
The restart.watch option allows you to define a list of directories/files to watch. Changes to these files will trigger a restart of the script.
This feature is powered by the Javascript file watcher Chokidar, you can install it as follows:
NPM:
npm install chokidar
Yarn:
yarn add chokidar
Logging
You can enable logging for each script by setting the logging option to true.
Logs will be shown in the console and will be prefixed with the script name.
To make the logs more readable, you can define a style for each script.
[
'style' => ['magenta', null, ['bold']],
]
Log options
'log_options' => [
// Apply the style to the full line, not just the script name
'apply_style_to_full_line' => true
],
These parameters are passed into the constructor of Symfony\Component\Console\Formatter\OutputFormatterStyle, you can refer to the documentation here:
https://symfony.com/doc/current/console/coloring.html
Working Directory
You can change the working directory for each script by setting the working_directory option.
When combining the working_directory option with the restart.watch option, the paths in the restart.watch option should be relative to the working_directory.
'working_directory' => 'path/to/working/directory',
ENV:
By default, all scripts will run with the same environment variables as the parent process.
When using the working_directory option, you can define a custom .env file in that directory to be used for that process instead of the default environment variables.
Credits
file-watcher: https://github.com/spatie/file-system-watcher/blob/main/bin/file-watcher.js
sabatino/artisan-dev 适用场景与选型建议
sabatino/artisan-dev 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.32k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2024 年 09 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「SabatinoMasala」 「Dev scripts」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sabatino/artisan-dev 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sabatino/artisan-dev 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sabatino/artisan-dev 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Automatically restart PHP application once the source code changes
Shell scripts to manage database backups, asset backups, file permissions, asset syncing, cache clearing, and database syncing between Craft CMS environments
Composer plugin replacing placeholders in the scripts section by dynamic values
PHP client for the Replicate API
Monolog bridge for PHP Debugbar
Simple and fast methods to read private properties and call private methods
统计信息
- 总下载量: 1.32k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-02