Readouble

Laravel 8.x HTTPクライアント

イントロダクションIntroduction

Laravelは、Guzzle HTTPクライアントの周りに表現力豊かで最小限のAPIを提供し、他のWebアプリケーションと通信するための外部HTTPリクエストをすばやく作成できるようにします。LaravelによるGuzzleのラッパーは、最も一般的なユースケースと素晴らしい開発者エクスペリエンスに焦点を当てています。Laravel provides an expressive, minimal API around the Guzzle HTTP client[http://docs.guzzlephp.org/en/stable/], allowing you to quickly make outgoing HTTP requests to communicate with other web applications. Laravel's wrapper around Guzzle is focused on its most common use cases and a wonderful developer experience.

使い始める前に、アプリケーションの依存関係としてGuzzleパッケージを確実にインストールしてください。デフォルトでLaravelはこの依存パッケージを自動的に含めます。もし、以前にパッケージを削除したことがある場合は、Composerを介して再度インストールしてください。Before getting started, you should ensure that you have installed the Guzzle package as a dependency of your application. By default, Laravel automatically includes this dependency. However, if you have previously removed the package, you may install it again via Composer:

composer require guzzlehttp/guzzle

リクエストの作成Making Requests

リクエストを行うには、Httpファサードが提供するheadgetpostputpatchdeleteメソッドを使用します。まず、外部のURLに対して基本的なGETリクエストを行う方法を見てみましょう。To make requests, you may use the head, get, post, put, patch, and delete methods provided by the Http facade. First, let's examine how to make a basic GET request to another URL:

use Illuminate\Support\Facades\Http;

$response = Http::get('http://example.com');

getメソッドはIlluminate\Http\Client\Responseのインスタンスを返します。これは、レスポンスを調べるために使用できるさまざまなメソッドを提供します。The get method returns an instance of Illuminate\Http\Client\Response, which provides a variety of methods that may be used to inspect the response:

$response->body() : string;
$response->json($key = null) : array|mixed;
$response->object() : object;
$response->collect($key = null) : Illuminate\Support\Collection;
$response->status() : int;
$response->ok() : bool;
$response->successful() : bool;
$response->redirect(): bool;
$response->failed() : bool;
$response->serverError() : bool;
$response->clientError() : bool;
$response->header($header) : string;
$response->headers() : array;

Illuminate\Http\Client\ResponseオブジェクトはPHPのArrayAccessインターフェイスも実装しており、そのレスポンスのJSONレスポンスデータへ直接アクセスできます。The Illuminate\Http\Client\Response object also implements the PHP ArrayAccess interface, allowing you to access JSON response data directly on the response:

return Http::get('http://example.com/users/1')['name'];

リクエストのダンプDumping Requests

送信するリクエストインスタンスを送信して、スクリプトの実行を終了する前にダンプしたい場合は、リクエスト定義の先頭にddメソッドを追加できます。If you would like to dump the outgoing request instance before it is sent and terminate the script's execution, you may add the dd method to the beginning of your request definition:

return Http::dd()->get('http://example.com');

リクエストデータRequest Data

もちろん、POSTPUTPATCHリクエストを作成するときは、リクエストとともに追加のデータを送信するのが一般的であるため、これらのメソッドは2番目の引数としてデータの配列を受け入れます。デフォルトでデータはapplication/jsonコンテンツタイプを使用して送信されます。Of course, it is common when making POST, PUT, and PATCH requests to send additional data with your request, so these methods accept an array of data as their second argument. By default, data will be sent using the application/json content type:

use Illuminate\Support\Facades\Http;

$response = Http::post('http://example.com/users', [
    'name' => 'Steve',
    'role' => 'Network Administrator',
]);

GETリクエストクエリパラメータGET Request Query Parameters

GETリクエストを行うときは、クエリ文字列をURLに直接追加するか、キー/値ペアの配列をgetメソッドの2番目の引数として渡せます。When making GET requests, you may either append a query string to the URL directly or pass an array of key / value pairs as the second argument to the get method:

$response = Http::get('http://example.com/users', [
    'name' => 'Taylor',
    'page' => 1,
]);

フォームURLエンコードされたリクエストの送信Sending Form URL Encoded Requests

application/x-www-form-urlencodedコンテンツタイプを使用してデータを送信する場合は、リクエストを行う前にasFormメソッドを呼び出す必要があります。If you would like to send data using the application/x-www-form-urlencoded content type, you should call the asForm method before making your request:

$response = Http::asForm()->post('http://example.com/users', [
    'name' => 'Sara',
    'role' => 'Privacy Consultant',
]);

素のリクエスト本文の送信Sending A Raw Request Body

リクエストを行うときに素のリクエスト本文を指定する場合は、withBodyメソッドを使用できます。コンテンツタイプは、メソッドの2番目の引数を介して提供できます。You may use the withBody method if you would like to provide a raw request body when making a request. The content type may be provided via the method's second argument:

$response = Http::withBody(
    base64_encode($photo), 'image/jpeg'
)->post('http://example.com/photo');

マルチパートリクエストMulti-Part Requests

ファイルをマルチパートリクエストとして送信する場合は、リクエストを行う前にattachメソッドを呼び出す必要があります。このメソッドは、ファイルの名前とその内容を引数に取ります。必要に応じて、ファイルのファイル名と見なす3番目の引数を指定できます。If you would like to send files as multi-part requests, you should call the attach method before making your request. This method accepts the name of the file and its contents. If needed, you may provide a third argument which will be considered the file's filename:

$response = Http::attach(
    'attachment', file_get_contents('photo.jpg'), 'photo.jpg'
)->post('http://example.com/attachments');

ファイルの素の内容を渡す代わりに、ストリームリソースを渡すこともできます。Instead of passing the raw contents of a file, you may pass a stream resource:

$photo = fopen('photo.jpg', 'r');

$response = Http::attach(
    'attachment', $photo, 'photo.jpg'
)->post('http://example.com/attachments');

ヘッダHeaders

ヘッダは、withHeadersメソッドを使用してリクエストに追加できます。このwithHeadersメソッドは、キー/値ペアの配列を引数に取ります。Headers may be added to requests using the withHeaders method. This withHeaders method accepts an array of key / value pairs:

$response = Http::withHeaders([
    'X-First' => 'foo',
    'X-Second' => 'bar'
])->post('http://example.com/users', [
    'name' => 'Taylor',
]);

acceptメソッドを使って、アプリケーションがリクエストへのレスポンスとして期待するコンテンツタイプを指定できます。You may use the accept method to specify the content type that your application is expecting in response to your request:

$response = Http::accept('application/json')->get('http://example.com/users');

利便性のため、acceptJsonメソッドを使って、アプリケーションがリクエストへのレスポンスとしてapplication/jsonコンテンツタイプを期待することを素早く指定できます。For convenience, you may use the acceptJson method to quickly specify that your application expects the application/json content type in response to your request:

$response = Http::acceptJson()->get('http://example.com/users');

認証Authentication

基本認証のログイン情報とダイジェスト認証ログイン情報は、それぞれwithBasicAuthメソッドとwithDigestAuthメソッドを使用して指定します。You may specify basic and digest authentication credentials using the withBasicAuth and withDigestAuth methods, respectively:

// BASIC認証
$response = Http::withBasicAuth('taylor@laravel.com', 'secret')->post(...);

// ダイジェスト認証
$response = Http::withDigestAuth('taylor@laravel.com', 'secret')->post(...);

BearerトークンBearer Tokens

リクエストのAuthorizationヘッダにBearerトークンをすばやく追加したい場合は、withTokenメソッドを使用できます。If you would like to quickly add a bearer token to the request's Authorization header, you may use the withToken method:

$response = Http::withToken('token')->post(...);

タイムアウトTimeout

timeoutメソッドを使用して、レスポンスを待機する最大秒数を指定できます。The timeout method may be used to specify the maximum number of seconds to wait for a response:

$response = Http::timeout(3)->get(...);

指定したタイムアウトを超えると、Illuminate\Http\Client\ConnectionExceptionインスタンスを投げます。If the given timeout is exceeded, an instance of Illuminate\Http\Client\ConnectionException will be thrown.

再試行Retries

クライアントまたはサーバのエラーが発生した場合に、HTTPクライアントがリクエストを自動的に再試行するようにしたい場合は、retryメソッドを使用します。retryメソッドは、リクエストを試行する最大回数とLaravelが試行の間に待機するミリ秒数を引数に取ります。If you would like HTTP client to automatically retry the request if a client or server error occurs, you may use the retry method. The retry method accepts the maximum number of times the request should be attempted and the number of milliseconds that Laravel should wait in between attempts:

$response = Http::retry(3, 100)->post(...);

必要であれば、retryメソッドに第3引数を渡せます。第3引数には、実際に再試行を行うかどうかを決定するCallableを指定します。例えば、最初のリクエストでConnectionExceptionが発生した場合にのみ、リクエストを再試行したいとしましょう。If needed, you may pass a third argument to the retry method. The third argument should be a callable that determines if the retries should actually be attempted. For example, you may wish to only retry the request if the initial request encounters an ConnectionException:

$response = Http::retry(3, 100, function ($exception) {
    return $exception instanceof ConnectionException;
})->post(...);

すべてのリクエストが失敗した場合、Illuminate\Http\Client\RequestExceptionインスタンスを投げます。If all of the requests fail, an instance of Illuminate\Http\Client\RequestException will be thrown.

エラー処理Error Handling

Guzzleのデフォルト動作とは異なり、LaravelのHTTPクライアントラッパーは、クライアントまたはサーバのエラー(サーバからの「400」および「500」レベルの応答)で例外を投げません。successfulclientErrorserverErrorメソッドを使用して、これらのエラーのいずれかが返されたかどうかを判定できます。Unlike Guzzle's default behavior, Laravel's HTTP client wrapper does not throw exceptions on client or server errors (400 and 500 level responses from servers). You may determine if one of these errors was returned using the successful, clientError, or serverError methods:

// ステータスコードが200以上300未満か判定
$response->successful();

// ステータスコードが400以上か判定
$response->failed();

// レスポンスに400レベルのステータスコードがあるかを判定
$response->clientError();

// レスポンスに500レベルのステータスコードがあるかを判定
$response->serverError();

// クライアントまたはサーバエラーが発生した場合、指定コールバックを即座に実行
$response->onError(callable $callback);

例外を投げるThrowing Exceptions

あるレスポンスインスタンスのレスポンスステータスコードがクライアントまたはサーバのエラーを示している場合にIlluminate\Http\Client\RequestExceptionのインスタンスを投げたい場合場合は、throwthrowIfメソッドを使用します。If you have a response instance and would like to throw an instance of Illuminate\Http\Client\RequestException if the response status code indicates a client or server error, you may use the throw or throwIf methods:

$response = Http::post(...);

// クライアントまたはサーバのエラーが発生した場合は、例外を投げる
$response->throw();

// エラーが発生するか、指定条件が真の場合は、例外を投げる
$response->throwIf($condition);

return $response['user']['id'];

Illuminate\Http\Client\RequestExceptionインスタンスにはパブリック$responseプロパティがあり、返ってきたレスポンスを検査できます。The Illuminate\Http\Client\RequestException instance has a public $response property which will allow you to inspect the returned response.

throwメソッドは、エラーが発生しなかった場合にレスポンスインスタンスを返すので、他の操作をthrowメソッドにチェーンできます。The throw method returns the response instance if no error occurred, allowing you to chain other operations onto the throw method:

return Http::post(...)->throw()->json();

例外がなげられる前に追加のロジックを実行したい場合は、throwメソッドにクロージャを渡せます。クロージャを呼び出した後に、例外を自動的に投げるため、クロージャ内から例外を再発行する必要はありません。If you would like to perform some additional logic before the exception is thrown, you may pass a closure to the throw method. The exception will be thrown automatically after the closure is invoked, so you do not need to re-throw the exception from within the closure:

return Http::post(...)->throw(function ($response, $e) {
    //
})->json();

GuzzleオプションGuzzle Options

withOptionsメソッドを使用して、追加のGuzzleリクエストオプションを指定できます。withOptionsメソッドは、キー/値ペアの配列を引数に取ります。You may specify additional Guzzle request options[http://docs.guzzlephp.org/en/stable/request-options.html] using the withOptions method. The withOptions method accepts an array of key / value pairs:

$response = Http::withOptions([
    'debug' => true,
])->get('http://example.com/users');

同時リクエストConcurrent Requests

複数のHTTPリクエストを同時に実行したい場合があります。言い換えれば、複数のリクエストを順番に発行するのではなく、同時にディスパッチしたい状況です。これにより、低速なHTTP APIを操作する際のパフォーマンスが大幅に向上します。Sometimes, you may wish to make multiple HTTP requests concurrently. In other words, you want several requests to be dispatched at the same time instead of issuing the requests sequentially. This can lead to substantial performance improvements when interacting with slow HTTP APIs.

さいわいに、poolメソッドを使い、これを実現できます。poolメソッドは、Illuminate\Http\Client\Poolインスタンスを受け取るクロージャを引数に取り、簡単にリクエストプールにリクエストを追加してディスパッチできます。Thankfully, you may accomplish this using the pool method. The pool method accepts a closure which receives an Illuminate\Http\Client\Pool instance, allowing you to easily add requests to the request pool for dispatching:

use Illuminate\Http\Client\Pool;
use Illuminate\Support\Facades\Http;

$responses = Http::pool(fn (Pool $pool) => [
    $pool->get('http://localhost/first'),
    $pool->get('http://localhost/second'),
    $pool->get('http://localhost/third'),
]);

return $responses[0]->ok() &&
       $responses[1]->ok() &&
       $responses[2]->ok();

ご覧のように、各レスポンスインスタンスは、プールに追加した順でアクセスできます。必要に応じasメソッドを使い、リクエストに名前を付けると、対応するレスポンスへ名前でアクセスできるようになります。As you can see, each response instance can be accessed based on the order it was added to the pool. If you wish, you can name the requests using the as method, which allows you to access the corresponding responses by name:

use Illuminate\Http\Client\Pool;
use Illuminate\Support\Facades\Http;

$responses = Http::pool(fn (Pool $pool) => [
    $pool->as('first')->get('http://localhost/first'),
    $pool->as('second')->get('http://localhost/second'),
    $pool->as('third')->get('http://localhost/third'),
]);

return $responses['first']->ok();

マクロMacros

LaravelのHTTPクライアントでは、「マクロ」を定義可能です。マクロは、アプリケーション全体でサービスとやり取りする際に、共通のリクエストパスやヘッダを設定するために、流暢で表現力のあるメカニズムとして機能します。利用するには、アプリケーションの App\Providers\AppServiceProviderクラスのbootメソッド内で、マクロを定義します。The Laravel HTTP client allows you to define "macros", which can serve as a fluent, expressive mechanism to configure common request paths and headers when interacting with services throughout your application. To get started, you may define the macro within the boot method of your application's App\Providers\AppServiceProvider class:

use Illuminate\Support\Facades\Http;

/**
 * 全アプリケーションサービスの初期起動処理
 *
 * @return void
 */
public function boot()
{
    Http::macro('github', function () {
        return Http::withHeaders([
            'X-Example' => 'example',
        ])->baseUrl('https://github.com');
    });
}

マクロを設定したら、アプリケーションのどこからでもマクロを呼び出し、保留中のリクエストを指定した設定で作成できます。Once your macro has been configured, you may invoke it from anywhere in your application to create a pending request with the specified configuration:

$response = Http::github()->get('/');

テストTesting

多くのLaravelサービスは、テストを簡単かつ表現力豊かに作成するのに役立つ機能を提供しています。LaravelのHTTPラッパーも例外ではありません。Httpファサードのfakeメソッドを使用すると、リクエストが行われたときに、スタブ/ダミーレスポンスを返すようにHTTPクライアントに指示できます。Many Laravel services provide functionality to help you easily and expressively write tests, and Laravel's HTTP wrapper is no exception. The Http facade's fake method allows you to instruct the HTTP client to return stubbed / dummy responses when requests are made.

レスポンスのfakeFaking Responses

たとえば、リクエストごとに空の200ステータスコードレスポンスを返すようにHTTPクライアントに指示するには、引数なしでfakeメソッドを呼びだしてください。For example, to instruct the HTTP client to return empty, 200 status code responses for every request, you may call the fake method with no arguments:

use Illuminate\Support\Facades\Http;

Http::fake();

$response = Http::post(...);

Note: note リクエストをfakeする場合、HTTPクライアントミドルウェアは実行されません。これらのミドルウェアが正しく実行されたかのように、fakeレスポンスに対するエクスペクテーションを定義する必要があります。{note} When faking requests, HTTP client middleware are not executed. You should define expectations for faked responses as if these middleware have run correctly.

特定のURLのfakeFaking Specific URLs

もしくは、配列をfakeメソッドに渡すこともできます。配列のキーは、fakeしたいURLパターンとそれに関連するレスポンスを表す必要があります。*文字はワイルドカード文字として使用できます。FakeしないURLに対して行うリクエストは、実際に実行されます。Httpファサードのresponseメソッドを使用して、これらのエンドポイントのスタブ/fakeのレスポンスを作成できます。Alternatively, you may pass an array to the fake method. The array's keys should represent URL patterns that you wish to fake and their associated responses. The * character may be used as a wildcard character. Any requests made to URLs that have not been faked will actually be executed. You may use the Http facade's response method to construct stub / fake responses for these endpoints:

Http::fake([
    // GitHubエンドポイントのJSONレスポンスをスタブ
    'github.com/*' => Http::response(['foo' => 'bar'], 200, $headers),

    // Googleエンドポイントの文字列レスポンスをスタブ
    'google.com/*' => Http::response('Hello World', 200, $headers),
]);

一致しないすべてのURLをスタブするフォールバックURLパターンを指定する場合は、単一の*文字を使用します。If you would like to specify a fallback URL pattern that will stub all unmatched URLs, you may use a single * character:

Http::fake([
    // GitHubエンドポイントのJSONレスポンスをスタブ
    'github.com/*' => Http::response(['foo' => 'bar'], 200, ['Headers']),

    // 他のすべてのエンドポイントの文字列をスタブ
    '*' => Http::response('Hello World', 200, ['Headers']),
]);

fakeレスポンスの順番Faking Response Sequences

場合によっては、単一のURLが特定の順序で一連のfakeレスポンスを返すように指定する必要があります。これは、Http::sequenceメソッドを使用してレスポンスを作成することで実現できます。Sometimes you may need to specify that a single URL should return a series of fake responses in a specific order. You may accomplish this using the Http::sequence method to build the responses:

Http::fake([
    // GitHubエンドポイントの一連のレスポンスをスタブ
    'github.com/*' => Http::sequence()
                            ->push('Hello World', 200)
                            ->push(['foo' => 'bar'], 200)
                            ->pushStatus(404),
]);

レスポンスシーケンス内のすべてのレスポンスが消費されると、以降のリクエストに対し、レスポンスシーケンスは例外を投げます。シーケンスが空になったときに返すデフォルトのレスポンスを指定する場合は、whenEmptyメソッドを使用します。When all of the responses in a response sequence have been consumed, any further requests will cause the response sequence to throw an exception. If you would like to specify a default response that should be returned when a sequence is empty, you may use the whenEmpty method:

Http::fake([
    // GitHubエンドポイントの一連の応答をスタブ
    'github.com/*' => Http::sequence()
                            ->push('Hello World', 200)
                            ->push(['foo' => 'bar'], 200)
                            ->whenEmpty(Http::response()),
]);

一連のレスポンスをfakeしたいが、fakeする必要がある特定のURLパターンを指定する必要がない場合は、Http::fakeSequenceメソッドを使用します。If you would like to fake a sequence of responses but do not need to specify a specific URL pattern that should be faked, you may use the Http::fakeSequence method:

Http::fakeSequence()
        ->push('Hello World', 200)
        ->whenEmpty(Http::response());

FakeコールバックFake Callback

特定のエンドポイントに対して返すレスポンスを決定するために、より複雑なロジックが必要な場合は、fakeメソッドにクロージャを渡すことができます。このクロージャはIlluminate\Http\Client\Requestインスタンスを受け取り、レスポンスインスタンスを返す必要があります。クロージャ内で、返すレスポンスのタイプを決定するために必要なロジックを実行できます。If you require more complicated logic to determine what responses to return for certain endpoints, you may pass a closure to the fake method. This closure will receive an instance of Illuminate\Http\Client\Request and should return a response instance. Within your closure, you may perform whatever logic is necessary to determine what type of response to return:

Http::fake(function ($request) {
    return Http::response('Hello World', 200);
});

レスポンスの検査Inspecting Requests

レスポンスをfakeする場合、アプリケーションが正しいデータまたはヘッダを送信していることを確認するために、クライアントが受信するリクエストを調べたい場合があります。これは、Http::fakeを呼び出した後にHttp::assertSentメソッドを呼び出し実現します。When faking responses, you may occasionally wish to inspect the requests the client receives in order to make sure your application is sending the correct data or headers. You may accomplish this by calling the Http::assertSent method after calling Http::fake.

assertSentメソッドは、Illuminate\Http\Client\Requestインスタンスを受け取るクロージャを引数に受け、リクエストがエクスペクテーションに一致するかを示す論理値を返す必要があります。テストに合格するには、指定するエクスペクテーションに一致する少なくとも1つのリクエストが発行される必要があります。The assertSent method accepts a closure which will receive an Illuminate\Http\Client\Request instance and should return a boolean value indicating if the request matches your expectations. In order for the test to pass, at least one request must have been issued matching the given expectations:

use Illuminate\Http\Client\Request;
use Illuminate\Support\Facades\Http;

Http::fake();

Http::withHeaders([
    'X-First' => 'foo',
])->post('http://example.com/users', [
    'name' => 'Taylor',
    'role' => 'Developer',
]);

Http::assertSent(function (Request $request) {
    return $request->hasHeader('X-First', 'foo') &&
           $request->url() == 'http://example.com/users' &&
           $request['name'] == 'Taylor' &&
           $request['role'] == 'Developer';
});

必要に応じて、assertNotSentメソッドを使用して特定のリクエストが送信されないことを宣言できます。If needed, you may assert that a specific request was not sent using the assertNotSent method:

use Illuminate\Http\Client\Request;
use Illuminate\Support\Facades\Http;

Http::fake();

Http::post('http://example.com/users', [
    'name' => 'Taylor',
    'role' => 'Developer',
]);

Http::assertNotSent(function (Request $request) {
    return $request->url() === 'http://example.com/posts';
});

テスト中にいくつのリクエストを「送信」"したかを宣言するため、assertSentCountメソッドを使用できます。You may use the assertSentCount method to assert how many requests were "sent" during the test:

Http::fake();

Http::assertSentCount(5);

または、assertNothingSentメソッドを使用して、テスト中にリクエストが送信されないことを宣言することもできます。Or, you may use the assertNothingSent method to assert that no requests were sent during the test:

Http::fake();

Http::assertNothingSent();

イベントEvents

LaravelはHTTPリクエストを送信する過程で、3つのイベントを発行します。RequestSendingイベントはリクエストが送信される前に発生し、ResponseReceivedイベントは指定したリクエストに対するレスポンスを受け取った後に発行します。ConnectionFailedイベントは、指定したリクエストに対するレスポンスを受信できなかった場合に発行します。Laravel fires three events during the process of sending HTTP requests. The RequestSending event is fired prior to a request being sent, while the ResponseReceived event is fired after a response is received for a given request. The ConnectionFailed event is fired if no response is received for a given request.

RequestSendingConnectionFailedイベントは両方とも、パブリックの$requestプロパティを含んでおり、これを使えばIlluminate\Http\Client\Requestインスタンスを調べられます。同様に、ResponseReceivedイベントは、$requestプロパティと$responseプロパティを含んでおり、Illuminate\Http\Client\Responseインスタンスの検査に使用できます。このイベントのイベントリスナは、App\Providers\EventServiceProviderサービスプロバイダで登録します。The RequestSending and ConnectionFailed events both contain a public $request property that you may use to inspect the Illuminate\Http\Client\Request instance. Likewise, the ResponseReceived event contains a $request property as well as a $response property which may be used to inspect the Illuminate\Http\Client\Response instance. You may register event listeners for this event in your App\Providers\EventServiceProvider service provider:

/**
 * アプリケーションのイベントリスナマップ
 *
 * @var array
 */
protected $listen = [
    'Illuminate\Http\Client\Events\RequestSending' => [
        'App\Listeners\LogRequestSending',
    ],
    'Illuminate\Http\Client\Events\ResponseReceived' => [
        'App\Listeners\LogResponseReceived',
    ],
    'Illuminate\Http\Client\Events\ConnectionFailed' => [
        'App\Listeners\LogConnectionFailed',
    ],
];

章選択

設定

明暗テーマ
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に保存してある設定項目をすべて削除し、デフォルト状態へ戻します。

ヘッダー項目移動

キーボード操作