Readouble

Laravel 4.2 アップグレードガイド

4.1から4.2へのアップグレードUpgrading To 4.2 From 4.1

PHP 5.4 PHP 5.4

Laravel4.2を動作させるにはPHP 5.4.0以上が必要です。Laravel 4.2 requires PHP 5.4.0 or greater.

暗号化のデフォルトEncryption Defaults

app/config/app.php設定ファイルに、新しいcipherオプションが追加されました。このオプションの値は、MCRYPT_RIJNDAEL_256にすべきでしょう。Add a new cipher option in your app/config/app.php configuration file. The value of this option should be MCRYPT_RIJNDAEL_256.

'cipher' => MCRYPT_RIJNDAEL_256

この設定は、Laravelの暗号機能により使用される、デフォルトcipherをコントロールするために使用されます。This setting may be used to control the default cipher used by the Laravel encryption facilities.

注意: Laravel4.2では、最も安全な暗号化であると考えられる、MCRYPT_RIJNDAEL_128 (AES)がデフォルトの暗号化です。cipherをMCRYPT_RIJNDAEL_256へ戻すことが必要になるのは、Laravel4.1以前のバージョンで暗号化されたクッキー/値を解読する場合です。Note: In Laravel 4.2, the default cipher is MCRYPT_RIJNDAEL_128 (AES), which is considered to be the most secure cipher. Changing the cipher back to MCRYPT_RIJNDAEL_256 is required to decrypt cookies/values that were encrypted in Laravel <= 4.1

ソフトデリートは、トレイトを使用するようになりましたSoft Deleting Models Now Use Traits

モデルのソフトデリートを使用している場合、softDeletesプロパティーは必要なくなりました。SoftDeletingTraitを次のように使用してください。If you are using soft deleting models, the softDeletes property has been removed. You must now use the SoftDeletingTrait like so:

use Illuminate\Database\Eloquent\SoftDeletingTrait;

class User extends Eloquent {
	use SoftDeletingTrait;
}

それから、datesプロパティーにdeleted_atカラムを追記してください。You must also manually add the deleted_at column to your dates property:

class User extends Eloquent {
	use SoftDeletingTrait;

	protected $dates = ['deleted_at'];
}

ソフトデリート操作のAPIは、今までと変わりありません。The API for all soft delete operations remains the same.

注意: SoftDeletingTraitは、ベースモデルで使用してはいけません。実際のモデルクラスで使用します。Note: The SoftDeletingTrait can not be applied on a base model. It must be used on an actual model class.

View/PaginationのEnvironmentクラスの名前変更View / Pagination Environment Renamed

もし、Illuminate\View\Environmentクラスか、Illuminate\Pagination\Environmentクラスを直接参照している場合、Illuminate\View\FactoryIlluminate\Pagination\Factoryを代わりに参照するように、コードを変更してください。この2つのクラスは、機能をより良く表すように名前が変更されました。If you are directly referencing the Illuminate\View\Environment class or Illuminate\Pagination\Environment class, update your code to reference Illuminate\View\Factory and Illuminate\Pagination\Factory instead. These two classes have been renamed to better reflect their function.

ペジネーションプレゼンテーターの引数追加Additional Parameter On Pagination Presenter

Illuminate\Pagination\Presenterクラスを拡張している場合、getPageLinkWrapper抽象メソッドに、rel引数を追加するように変更してください。If you are extending the Illuminate\Pagination\Presenter class, the abstract method getPageLinkWrapper signature has changed to add the rel argument:

abstract public function getPageLinkWrapper($url, $page, $rel = null);

Iron.Ioキューの暗号化Iron.Io Queue Encryption

Iron.ioキュードライバーを使用している場合、新しいencryptオプションをキュー設定ファイルに追加する必要があります。If you are using the Iron.io queue driver, you will need to add a new encrypt option to your queue configuration file:

'encrypt' => true

Upgrading To 4.1.29 From <= 4.1.xUpgrading To 4.1.29 From <= 4.1.x

Laravel4.1.29では、全データベースドライバーのカラムクオーティングが向上しました。Eloquentモデルにfillableを使用していない場合の、複数代入に関する脆弱性からアプリケーションを保護します。複数代入されるのを防ぐためにモデルにfillableプロパティを使用している場合には、アプリケーションに脆弱性はありません。しかし、guardedを使用し、ユーザーがコントロールできる配列を"update"や"save”タイプの機能に渡しているのでしたら、複数代入のリスクにアプリケーションがさらされているため、4.1.29へすぐアップグレードすべきでしょう。Laravel 4.1.29 improves the column quoting for all database drivers. This protects your application from some mass assignment vulnerabilities when not using the fillable property on models. If you are using the fillable property on your models to protect against mass assignment, your application is not vulnerable. However, if you are using guarded and are passing a user controlled array into an "update" or "save" type function, you should upgrade to 4.1.29 immediately as your application may be at risk of mass assignment.

Laravel4.1.29へアップグレードするには、composer updateを実行するだけです。このリリースには、ソース修正が必要な変更は含まれていません。To upgrade to Laravel 4.1.29, simply composer update. No breaking changes are introduced in this release.

4.1.25以下から、4.1.26へのアップグレードUpgrading To 4.1.26 From <= 4.1.25

Laravel 4.1.26では、"Remember me"クッキーへのセキュリティーが強化されました。このアップデート以前は、Remeberクッキーが悪意のあるユーザーによりハイジャックされ、本当のユーザーがアカウントのパスワードをリセットしたり、ログアウトしたりしても、クッキーが長期に渡り有効なままにされてしまいました。Laravel 4.1.26 introduces security improvements for "remember me" cookies. Before this update, if a remember cookie was hijacked by another malicious user, the cookie would remain valid for a long period of time, even after the true owner of the account reset their password, logged out, etc.

今回の変更により、usersテーブル(もしくはユーザー管理を行うためのテーブル)へ、新しいremember_tokenカラムを追加する必要があります。この変更により、ユーザーがアプリケーションにログインするたびに、真新しいトークンが割り当てられます。このトークンはユーザーがアプリケーションからログアウトするたびに、再生成されます。この実装により、もしも"Remember me"クッキがーハイジャックされても、アプリケーションからログアウトすれば、そのクッキーは無効になります。This change requires the addition of a new remember_token column to your users (or equivalent) database table. After this change, a fresh token will be assigned to the user each time they login to your application. The token will also be refreshed when the user logs out of the application. The implications of this change are: if a "remember me" cookie is hijacked, simply logging out of the application will invalidate the cookie.

アップデート法Upgrade Path

最初に、新しいremember_token(null値可能なVARCHAR(100)かTEXTなど)カラムをusersテーブルに追加してください。First, add a new, nullable remember_token of VARCHAR(100), TEXT, or equivalent to your users table.

次に、Eloquent認証ドライバーを使用しているのであれば、Userクラスへ以下の3クラスを追加してください。Next, if you are using the Eloquent authentication driver, update your User class with the following three methods:

public function getRememberToken()
{
	return $this->remember_token;
}

public function setRememberToken($value)
{
	$this->remember_token = $value;
}

public function getRememberTokenName()
{
	return 'remember_token';
}

**注意:**この変更により、現在使用中の"Remember me"セッションは無効となるため、全ユーザーはアプリケーションへの再認証を強制されます。Note: All existing "remember me" sessions will be invalidated by this change, so all users will be forced to re-authenticate with your application.

パッケージメンテナーの方へPackage Maintainers

Illuminate\Auth\UserProviderInterfaceへ、新しいメソッドが2つ追加されました。実装のサンプルは、デフォルトドライバーをご覧ください。Two new methods were added to the Illuminate\Auth\UserProviderInterface interface. Sample implementations may be found in the default drivers:

public function retrieveByToken($identifier, $token);

public function updateRememberToken(UserInterface $user, $token);

Illuminate\Auth\UserInterfaceにも、「アップデート法」で説明している、新しい3つのメソッドが追加されました。The Illuminate\Auth\UserInterface also received the three new methods described in the "Upgrade Path".

4.0から4.1へアップグレードUpgrading To 4.1 From 4.0

コンポーサー依存パッケージのアップグレードUpgrading Your Composer Dependency

アプリケーションをLaravel4.1へアップグレードするには、composer.jsonファイルの中のlaravel/frameworkのバージョンを4.1に変更します。To upgrade your application to Laravel 4.1, change your laravel/framework version to 4.1.* in your composer.json file.

ファイルの置き換えReplacing Files

public/index.phpファイルをこのリポジトリーの新バージョンへ置き換えて下さい。Replace your public/index.php file with this fresh copy from the repository[https://github.com/laravel/laravel/blob/master/public/index.php].

artisanファイルをこのリポジトリーの新バージョンへ置き換えて下さい。Replace your artisan file with this fresh copy from the repository[https://github.com/laravel/laravel/blob/master/artisan].

設定ファイルとオプションの追加Adding Configuration Files & Options

app/config/app.php設定ファイル中のaliasesproviders配列を更新します。変更する内容はこのファイルで確認して下さい。自分で追加したサービスプロバーダーとエイリアスを書き戻すのを忘れないで下さい。Update your aliases and providers arrays in your app/config/app.php configuration file. The updated values for these arrays can be found in this file[https://github.com/laravel/laravel/blob/master/app/config/app.php]. Be sure to add your custom and package service providers / aliases back to the arrays.

新規にapp/config/remote.phpファイルをこのリポジトリーから取得し、追加して下さい。Add the new app/config/remote.php file from the repository[https://github.com/laravel/laravel/blob/master/app/config/remote.php].

app/config/session.phpファイルへ新しいexpire_on_close設定オプションを追加して下さい。デフォルト値はfalseです。Add the new expire_on_close configuration option to your app/config/session.php file. The default value should be false.

app/config/queue.phpファイルへ新しいfailed設定セクションを追加して下さい。セクションのデフォルト値は以下の通りです。Add the new failed configuration section to your app/config/queue.php file. Here are the default values for the section:

'failed' => array(
	'database' => 'mysql', 'table' => 'failed_jobs',
),

(オプション):app/config/view.phpファイル中のpagination設定オプションをpagination::slider-3に変更することもできます。(Optional) Update the pagination configuration option in your app/config/view.php file to pagination::slider-3.

コントローラーの更新Controller Updates

もし、app/controllers/BaseController.phpが頭のところでuse文を使用していたら、use Illuminate\Routing\Controllers\Controller;use Illuminate\Routing\Controller;へ変更して下さい。If app/controllers/BaseController.php has a use statement at the top, change use Illuminate\Routing\Controllers\Controller; to use Illuminate\Routing\Controller;.

パスワードリマインダーの更新Password Reminders Updates

パスワードリマインダーは自由度を増すために全体的に見なおされました。php artisan auth:reminders-controller Artisanコマンドを実行し、作成される新しいスタブコントローラーを調べてみて下さい。もしくは、更新されたドキュメントを読み、それに従ってアプリケーションを更新して下さい。Password reminders have been overhauled for greater flexibility. You may examine the new stub controller by running the php artisan auth:reminders-controller Artisan command. You may also browse the updated documentation[/docs/4.2/security#password-reminders-and-reset] and update your application accordingly.

app/lang/en/reminders.php言語ファイルをこちらの更新済みファイルに合わせて変更して下さい。Update your app/lang/en/reminders.php language file to match this updated file[https://github.com/laravel/laravel/blob/master/app/lang/en/reminders.php].

環境決定の更新Environment Detection Updates

セキュリティーの観点から、アプリケーションの環境を決定するためにURLのドメインはもう使用されなくなりました。これらの値は簡単に偽装でき、リクエストの環境を変更する攻撃が可能です。コンピューターのホスト名を利用するように、環境決定コードを変更して下さい。(hostnameコマンドがMac、Linux、Windowsで使用できます。)For security reasons, URL domains may no longer be used to detect your application environment. These values are easily spoofable and allow attackers to modify the environment for a request. You should convert your environment detection to use machine host names (hostname command on Mac, Linux, and Windows).

ログファイルの単純化Simpler Log Files

今回よりLaravelは、app/storage/logs/laravel.logファイルのみを作成、使用するようになりました。しかし、この動作はapp/start/global.phpファイルで設定できるままになっています。Laravel now generates a single log file: app/storage/logs/laravel.log. However, you may still configure this behavior in your app/start/global.php file.

Trailing Slashリダイレクトの削除Removing Redirect Trailing Slash

bootstrap/start.phpファイルの中から、$app->redirectIfTrailingSlash()'の呼び出しを削除して下さい。この機能はフレームワークに含まれている.htaccess`ファイルで処理されるようになったため、メソッドは必要なくなりました。In your bootstrap/start.php file, remove the call to $app->redirectIfTrailingSlash(). This method is no longer needed as this functionality is now handled by the .htaccess file included with the framework.

次に、public/.htaccessファイルを最後のスラッシュを処理する新バージョンへ置き換えて下さい。Next, replace your Apache .htaccess file with this new one[https://github.com/laravel/laravel/blob/master/public/.htaccess] that handles trailing slashes.

現在のルートへのアクセスCurrent Route Access

現在のルートへアクセスするには、Route::getCurrentRoute()の代わりに、Route::current()が使えるようになりました。The current route is now accessed via Route::current() instead of Route::getCurrentRoute().

Composerの更新Composer Update

以上の変更を行ったら、アプリケーションのコアファイルを更新するために、composer updateを実行して下さい!クラスのロードエラーになった場合は、updateコマンドを--no-scriptsオプションを付け、実行してみてください。ですから、composer update --no-scriptsと実行します。Once you have completed the changes above, you can run the composer update function to update your core application files! If you receive class load errors, try running the update command with the --no-scripts option enabled like so: composer update --no-scripts.

ワイルドカードイベントリスナーWildcard Event Listeners

ワイルドカードイベントリスナーは、ハンドラー関数の引数にイベントを渡さなくなりました。発行されたイベントを見つける必要がある場合は、Event::firing()を使用してください。The wildcard event listeners no longer append the event to your handler functions parameters. If you require finding the event that was fired you should use Event::firing().

章選択

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!…]形式の挿入削除行の表示形式です。

テストコード表示
両コード表示
Pestのみ表示
PHPUnitのみ表示
和文変換

対象文字列と置換文字列を半角スペースで区切ってください。(最大5組各10文字まで)

本文フォント

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

コードフォント

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

保存内容リセット

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

ヘッダー項目移動

キーボード操作