mirror of
https://github.com/Mibew/boilerplate-plugin.git
synced 2025-02-05 08:44:42 +03:00
Add routing examples
This commit is contained in:
parent
6be97b32a8
commit
e454b69740
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Mibew\Mibew\Plugin\Boilerplate\Controller;
|
||||
|
||||
use Mibew\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* Serve license info page
|
||||
*/
|
||||
class HelloWorldController extends AbstractController
|
||||
{
|
||||
/**
|
||||
* Generate content for "mibew_boilerplate_hello" route.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function indexAction(Request $request)
|
||||
{
|
||||
return new Response('Hello ' . $request->attributes->get('name') . '!');
|
||||
}
|
||||
}
|
11
Mibew/Mibew/Plugin/Boilerplate/routing.yml
Normal file
11
Mibew/Mibew/Plugin/Boilerplate/routing.yml
Normal file
@ -0,0 +1,11 @@
|
||||
# Here we can easily define custom routes. Let's create a "Hello world!" page.
|
||||
mibew_boilerplate_hello:
|
||||
# Relative path from the Mibew web root is used here.
|
||||
path: /mibew-boilerplate-hello/{name}
|
||||
# Set some defaults for the request
|
||||
defaults:
|
||||
# This value is special. It tells the system what action should be
|
||||
# invoked for the response
|
||||
_controller: Mibew\Mibew\Plugin\Boilerplate\Controller\HelloWorldController::indexAction
|
||||
# Set a default value for the "{name}" placeholder
|
||||
name: world
|
Loading…
Reference in New Issue
Block a user