为Laravel的artisan指令增加bash脚本

来源:互联网 发布:网络销售茶叶好做吗 编辑:程序博客网 时间:2024/06/05 04:00
#!/bin/bashif [ -f "./artisan" ]; then        php artisan "$@"else        if [ "$1" == "create" ]; then                       if [ ! `which git` ]; then                                         echo "For this installer to work you'll need to install Git."                                        echo 'http://gitref.org/'        fi                git clone --recursive git://github.com/laravel/laravel.git "./$2"                cd "$2"; chmod -R 0777 storage/        else                echo 'This is not a valid laravel installation so artisan is a bit lost.'                echo 'http://laravel.com/docs/install#installation'        fifi



保存为/usr/bin/artisan  并执行 chmod +x /usr/bin/artisan  赋予执行权限
然后,你就可以进入你的项目文件夹,只需输入bash命令 "artisan create myapp",就会自动从github上clone一份最新的Laravel框架,并会自动设置storage文件夹的权限。之后,你可以直接输入“ artisan xxxx  xxx”的指令了,而不用输入'php artisan xxxx xxxx' 。
0 0
原创粉丝点击