ウェブ職人のためのPHPフレームワーク
http://laravel.jp/
composerはこちら
$ composer global require "laravel/installer=~1.4"
Pathを通しておく
$ echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bash_profile
/var/www/vhost/hogehoge.comにインストールするとする。
# cd /var/www/vhost/hogehoge.com # laravel new
$ php artisan --version Laravel Framework 5.7.21
/var/www/vhost/hogehoge.comにlaravel newしたとする
<VirtualHost *:80> ServerName hogehoge.com DocumentRoot /var/www/vhost/hogehoge.com/public ・ ・
php artisan serve --host 0.0.0.0
routes/web.phpに下記行追加
routes/web.php
Route::get('hello', 'HelloController@index');
$ php artisan make:controller HelloController
app/Http/Controllers/HelloController.php
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class HelloController extends Controller { public function index() { return view('hello'); } }
resources/views/hello.blade.php
<!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <title>Hello World</title> </head> <body> Hello World </body> </html>
$ laravel new In NewCommand.php line 42: The Zip PHP extension is not installed. Please install it and try again. new [--dev] [--5.2] [--] [<name>]
対応
# yum install php-pecl-zip
Script "post-install-cmd" is not defined in this package
対応
$ composer global require "laravel/installer=~1.4"
> php artisan clear-compiled Mcrypt PHP extension required. Script php artisan clear-compiled handling the post-update-cmd event returned with error code 1
対応
# yum install php-mcrypt