Readouble

Laravel 4.2 インストール

コンポーサーのインストールInstall Composer

Laravelはパッケージの依存管理にComposerを活用しています。最初に composer.pharをダウンロードします。PHARアーカイブをダウンロードしたら、ローカルのプロジェクトディレクトリーに設置することもできますし、usr/local/binに設置しシステムグローバルで使用することもできます。Windowsをご使用ならば、Windowsインストーラーを使用してください。Laravel utilizes Composer[http://getcomposer.org] to manage its dependencies. First, download a copy of the composer.phar. Once you have the PHAR archive, you can either keep it in your local project directory or move to usr/local/bin to use it globally on your system. On Windows, you can use the Composer Windows installer[https://getcomposer.org/Composer-Setup.exe].

LaravelのインストールInstall Laravel

LaravelインストーラーによるインストールVia Laravel Installer

最初にComposerを使用し、Laravelインストーラーをダウンロードします。First, download the Laravel installer using Composer.

composer global require "laravel/installer=~1.1"

laravelコマンドが端末で実行できるように、~/.composer/vendor/binディレクトリーへPATHを通してください。Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal.

インストールが完了したら、後はただlaravel newコマンドで、指定したディレクトリーに真新しいLaravelプロジェクトが作成されます。例えば、laravel new blogと打ち込めば、blogというディレクトリーに、必要なパッケージが全部揃って、Laravelがインストールされます。このインストール方法は、Composerを使うよりも多少早いです。Once installed, the simple laravel new command will create a fresh Laravel installation in the directory you specify. For instance, laravel new blog would create a directory named blog containing a fresh Laravel installation with all dependencies installed. This method of installation is much faster than installing via Composer.

Composer Create-ProjectによるインストールVia Composer Create-Project

また、ターミナルでコンポーサーのcreate-projectコマンドを実行して、Laravelをインストールすることもできます。You may also install Laravel by issuing the Composer create-project command in your terminal:

composer create-project laravel/laravel {directory} 4.2 --prefer-dist

ダウンロードによるインストールVia Download

Composerをインストールしたら、GitHubのLaravelリポジトリーから、自分でダウンロードしてください。ダウンロードし終えたら、手動で作成したディレクトリーのルートで、composer installコマンドを実行してください。このコマンドによりフレームワークに必要な依存パッケージがインストールされます。インストールを終了するためには、Gitがサーバーにインストールされている必要があります。Once Composer is installed, download the 4.2 version[https://github.com/laravel/laravel/archive/v4.2.11.zip] of the Laravel framework and extract its contents into a directory on your server. Next, in the root of your Laravel application, run the php composer.phar install (or composer install) command to install all of the framework's dependencies. This process requires Git to be installed on the server to successfully complete the installation.

Laravelフレームワークをアップデートしたい場合は、php composer.phar update commandを実行してください。If you want to update the Laravel framework, you may issue the php composer.phar update command.

サーバー要件Server Requirements

Laravelフレームワークには、多少のシステム動作要件があります。The Laravel framework has a few system requirements:

  • PHP >= 5.4PHP >= 5.4
  • MCrypt PHP拡張MCrypt PHP Extension

いくつかのOSでは、PHP 5.5を使用する場合、PHP JSON拡張をインストールする必要があります。Ubuntuを使用する場合、apt-get install php5-jsonでインストールされます。As of PHP 5.5, some OS distributions may require you to manually install the PHP JSON extension. When using Ubuntu, this can be done via apt-get install php5-json.

設定Configuration

Laravelをインストールし終えたら、最初に行うべきなのは、ランダム文字列をアプリケーションキーへ設定することです。Composerを利用してLaravelをインストールした場合、key:generateコマンドが自動的に実行され、既に設定済みになっていることでしょう。通常、これは32文字の文字列です。値はapp.php設定ファイルで指定します。アプリケーションキーを設定しないと、セッションや他の暗号化が必要な情報は、安全ではありません。The first thing you should do after installing Laravel is set your application key to a random string. If you installed Laravel via Composer, this key has probably already been set for you by the key:generate command. Typically, this string should be 32 characters long. The key can be set in the app.php configuration file. If the application key is not set, your user sessions and other encrypted data will not be secure.

Laravelのその他の設定は、最初から行う必要がありません。ここで開発を開始しても良いのです!しかし、app/config/app.phpファイルと、その中の記述を確認しておいたほうが良いでしょう。アプリケーションに応じ、変更したいtimezonelocalのような多くのオプションが含まれています。Laravel needs almost no other configuration out of the box. You are free to get started developing! However, you may wish to review the app/config/app.php file and its documentation. It contains several options such as timezone and locale that you may wish to change according to your application.

Laravelのインストールを終えたら、ローカル環境の設定も行ってください。これにより、ローカルマシーン上で開発している時に、詳細なエラーメッセージを受け取ることができるようになります。デフォルトでは、実機環境向けの設定ファイルのために、詳細なエラー表示は、抑制されています。Once Laravel is installed, you should also configure your local environment[/docs/4.2/configuration#environment-configuration]. This will allow you to receive detailed error messages when developing on your local machine. By default, detailed error reporting is disabled in your production configuration file.

**注意:**実働のアプリケーションでは、app.debugtrueに設定してはいけません。決して、行わないでください。Note: You should never have app.debug set to true for a production application. Never, ever do it.

パーミッションPermissions

Laravelではひとつだけパーミッションの設定が必要です。app/storageにあるフォルダー全部に対し、Webサーバーによる書き込みアクセスができるように設定して下さい。Laravel may require one set of permissions to be configured: folders within app/storage require write access by the web server.

パスPaths

フレームワークで利用するディレクトリーパスの多くは、設定可能です。こうしたディレクトリーの場所を変更する場合は、bootstrap/paths.phpファイルを調べてください。Several of the framework directory paths are configurable. To change the location of these directories, check out the bootstrap/paths.php file.

きれいなURLPretty URLs

ApacheApache

index.phpをURLへ付けなくても利用できるようにするため、public/.htaccessファイルが最初からフレームワークへ含まれています。Apacheを利用し、Laravelアプリケーションを動かす場合、mod_rewriteモジュールを確実に有効にしてください。The framework ships with a public/.htaccess file that is used to allow URLs without index.php. If you use Apache to serve your Laravel application, be sure to enable the mod_rewrite module.

Laravelに付属している、.htaccessファイルが、皆さんのApache環境で動作しない場合は、以下の設定を試してください。If the .htaccess file that ships with Laravel does not work with your Apache installation, try this one:

Options  FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

NginxNginx

Nginxでは、サイト設定に以下のディレクティブを使用すれば、「きれい」なURLを使えます。On Nginx, the following directive in your site configuration will allow "pretty" URLs:

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

章選択

Artisan CLI

設定

明暗テーマ
light_mode
dark_mode
brightness_auto システム設定に合わせる
テーマ選択
photo_size_select_actual デフォルト
photo_size_select_actual モノクローム(白黒)
photo_size_select_actual Solarized風
photo_size_select_actual GitHub風(青ベース)
photo_size_select_actual Viva(黄緑ベース)
photo_size_select_actual Happy(紫ベース)
photo_size_select_actual Mint(緑ベース)
コードハイライトテーマ選択

明暗テーマごとに、コードハイライトのテーマを指定できます。

テーマ配色確認
スクリーン表示幅
640px
80%
90%
100%

768px以上の幅があるときのドキュメント部分表示幅です。

インデント
無し
1rem
2rem
3rem
原文確認
原文を全行表示
原文を一行ずつ表示
使用しない

※ 段落末のEボタンへカーソルオンで原文をPopupします。

Diff表示形式
色分けのみで区別
行頭の±で区別
削除線と追記で区別

※ [tl!…]形式の挿入削除行の表示形式です。

Pagination和文
ペジネーション
ペギネーション
ページネーション
ページ付け
Scaffold和文
スカフォールド
スキャフォールド
型枠生成
本文フォント

総称名以外はCSSと同様に、"〜"でエスケープしてください。

コードフォント

総称名以外はCSSと同様に、"〜"でエスケープしてください。

保存内容リセット

localStrageに保存してある設定項目をすべて削除し、デフォルト状態へ戻します。

ヘッダー項目移動

キーボード操作