搭建步骤
1、install PHP
brew install php60
2、install Composer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
or user curl to install
curl -sS [https://getcomposer.org/installer](https://getcomposer.org/installer) | php
下载 composer.phar 后,将它放到 usr/local/bin 目录中中,成为全域指令。
mv composer.phar /usr/local/bin/composer
配置composer环境变量:
export PATH=~/.composer/vendor/bin:$PATH
此时终端运行composer命令,若出现权限问题,给文件加权限:
sudo chmod a+x composer.phar
3、create new application
laravel new blog
or
composer create-project --prefer-dist laravel/laravel blog
4、启动本地服务
php artisan serve
成功后会出现:
Laravel development server started: <http://127.0.0.1:8000>