私は、学習の練習としてSymfonyコンポーネントの上に構築された独自のPHPフレームワークを作成しています。私はhttp://symfony.com/doc/current/create_framework/index.htmlにあるチュートリアルにしたがってフレームワークを作成しました。Symfony3アノテーションルートのフックアップフックアップ
私は、注釈を使用してコントローラに対して自分のルートを配線したいと考えています。私は
:私は注釈をロードするために以下のクラスに遭遇してきたが、私はそれを使用するかどうかはわかりません
// Create the route collection
$routes = new RouteCollection();
$routes->add('home', new Route('/{slug}', [
'slug' => '',
'_controller' => 'Controllers\HomeController::index',
]));
// Create a context using the current request
$context = new RequestContext();
$context->fromRequest($request);
// Create the url matcher
$matcher = new UrlMatcher($routes, $context);
// Try to get a matching route for the request
$request->attributes->add($matcher->match($request->getPathInfo()));
:私は現在、セットアップへのルーティングを次のコードを持っています誰かが助けてくれたらそれを感謝します。
ありがとうございました