Ground Sunlight

Windowsで作る - PHPプログラミングの開発環境

ユーザ用ツール

サイト用ツール


slim:4:concepts

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
slim:4:concepts [2020/10/02 13:56]
y2sunlight [依存性コンテナ―]
slim:4:concepts [2020/10/07 21:19] (現在)
y2sunlight
行 1: 行 1:
-> 編集中 +====== Slim4 コンセプト ======
- +
----- +
- +
-====== Slim4 コンセプト ======+
 Version 4.5.0 Version 4.5.0
  
- --- //[[http://www.y2sunlight.com|y2sunlight]] 2020-03-05//+ --- //[[http://www.y2sunlight.com|y2sunlight]] 2020-09-23//
  
 [[slim:top|Slim に戻る]] [[slim:top|Slim に戻る]]
行 12: 行 8:
 関連記事 関連記事
  
-  * [[slim:4:install|Slim4インストール]] +  * [[slim:4:install|Slim4 インストール]] 
-  * Slim4コンセプト +  * Slim4 コンセプト 
-  * [[slim:4:basic|Slim4の基本的な使い方]]+  * [[slim:4:request|Slim4 リクエスト]] 
 +  * [[slim:4:response|Slim4 レスポンス]] 
 +  * [[slim:4:routing|Slim4 ルーティング]] 
 +  * [[slim:4:middleware|Slim4 ミドルウェア]] 
 +  * [[slim:4:cookbook|Slim4  クックブック]]
  
-本章は以下のサイトの ''**Concepts**'' のセクションを翻訳し若干の補足を加えたのもです。+本章は以下のサイトの **Concepts** のセクションを翻訳し若干の補足を加えたのもです。
  
   * https://www.slimframework.com/docs/v4/   * https://www.slimframework.com/docs/v4/
行 417: 行 417:
 ===== 依存性コンテナ― ===== ===== 依存性コンテナ― =====
  
-Slim uses an optional dependency container to prepare, manage, and inject application dependencies. Slim supports containers that implement PSR-11 like PHP-DI.+Slimは、オプションの依存性コンテナーを使用して、アプリケーションの依存関係を準備、管理、および注入します。Slimは、[[https://php-di.org/doc/frameworks/slim.html|PHP-DI]] のような [[https://www.php-fig.org/psr/psr-11/|PSR-11]] を実装するコンテナーをサポートします。 
 + 
 +> PSR-11の邦訳は[[psr:psr11|こちら]]にあります。 
 + 
 +\\
  
-==== Example usage with PHP-DI ====+==== PHP-DIでの使用例 ====
  
-You don’t have to provide a dependency container. If you do, however, you must provide an instance of the container to ''AppFactory'' before creating an ''App''.+依存関係コンテナを必ず提供する必要があるとは限りません。但し、そうする場合は、''App'' を作成する前に、コンテナのインスタンスを ''AppFactory'' に与える必要があります。
  
 <code php> <code php>
行 440: 行 444:
 </code> </code>
  
-Add a service to your container:+そして、コンテナにサービスを追加します:
  
 <code php> <code php>
行 449: 行 453:
 </code> </code>
  
-You can fetch services from your container explicitly as well as from inside a Slim application route like this:+次のように、明示的にコンテナからからだけでなく、Slimアプリケーションルートの内からサービスをフェッチできます:
  
 <code php> <code php>
行 470: 行 474:
 </code> </code>
  
-To test if a service exists in the container before using it, use the ''has()'' method, like this:+コンテナを使用する前にサービスがコンテナに存在するかどうかをテストするには、次のように ''has()'' メソッドを使用します:
  
 <code php> <code php>
行 492: 行 496:
 \\ \\
  
-==== Configuring the application via a container ====+==== コンテナを介したアプリケーションの構成 ====
  
-In case you want to create the ''App'' with dependencies already defined in your container, you can use the ''AppFactory::createFromContainer()'' method.+コンテナに依存性が既に定義されている ''App'' を作成する場合は、''AppFactory::createFromContainer()'' メソッドが使用できます。
  
-**Example**+**例題**
  
 <code php> <code php>
行 525: 行 529:
 </code> </code>
  
-Supported App dependencies are:+サポートされているアプリの依存関係は次のとおりです:
  
   * Psr\Http\Message\ResponseFactoryInterface   * Psr\Http\Message\ResponseFactoryInterface
slim/4/concepts.1601614565.txt.gz · 最終更新: 2020/10/02 13:56 by y2sunlight