ha17 / laravel-artisan-global
使 artisan 命令可以从 Laravel 安装中的任何目录运行
这个包的官方仓库似乎已经不存在,因此该包已被冻结。
1.0.0
2017-06-16 20:42 UTC
This package is not auto-updated.
Last update: 2023-06-24 20:33:59 UTC
README
目的
使您能够从 Laravel 项目的任何目录运行 'artisan [命令]',而无需切换到项目目录的顶部。
安装
composer global require ha17/laravel-artisan-global
(非常重要,这是 全局 的;这是它的全部意义。否则,正常的 artisan 命令运行正常)
确保 ~/.composer/global/bin 在您的路径中,通过将以下内容添加到您的 ~/.bashrc 或类似文件
if [ -e "$HOME/.composer/vendor/bin" ]; then
export PATH="$PATH:$HOME/.composer/vendor/bin";
fi
使用方法
旧版本:php artisan [命令]
新版本:artisan [命令]
错误
此命令会查找 'artisan' 的目录结构。
如果您在包含 'artisan' 的目录中,它将工作
(/) /path/to/laravel-install/ # artisan [command]
如果您在 'artisan' 的子目录中,它将工作。
(/) /path/to/laravel-install/app # artisan [command]
(/) /path/to/laravel-install/storage # artisan [command]
(/) /path/to/laravel-install/resources/views # artisan [command]
... etc
如果您在 'artisan' 的上级目录中,它将不会工作。
(X) /path/to # artisan [command] (Nope!)
如果您命名了其他文件为 'artisan'(无扩展名),它可能会尝试运行它。如果您决定这样做,结果可能会有所不同。
# ls -l /path/to/larvel-install/storage
app artisan content framework logs (you added 'artisan' here)
# /path/to/laravel-install/storage # artisan [command] (Nope: it's going to pick up on the file you added, not the real command)