Skip to content

Instantly share code, notes, and snippets.

@tierra
Last active March 21, 2018 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tierra/2632372 to your computer and use it in GitHub Desktop.
Save tierra/2632372 to your computer and use it in GitHub Desktop.
Identical route configurations with CakePHP, Laravel, Ruby on Rails, Symfony, and Zend Framework
<?php
Router::connect('/hello/world', array('controller' => 'hello', 'action' => 'world'));
<?php
Route::get('hello/world', 'HelloController@getWorld');
ExampleApp::Application.routes.draw do
match '/hello/world' => 'Hello#world'
end
app:
path: /hello/world
defaults: { _controller: AppBundle:Hello:world }
<?php
return array(
'di' => array(
'instance' => array(
'Zend\Mvc\Router\RouteStack' => array(
'parameters' => array(
'routes' => array(
'module-hello-world' => array(
'type' => `Zend\Mvc\Router\Http\Literal`,
'options' => array(
'route' => '/hello/world',
'defaults' => array(
'controller' => 'Module\Controller\HelloController',
'action' => 'world',
),
),
),
),
),
),
),
// ... other di configuration ...
),
);
@burzum
Copy link

burzum commented Mar 21, 2018

@tierra the upcoming version 3.6 of CakePHP supports this as well:

Router::connect('/hello/world', 'Hello::world');

See https://github.com/cakephp/cakephp/pull/11688/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment