PHP code example of makallio85 / yaml-route

1. Go to this page and download the library: Download makallio85/yaml-route library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

makallio85 / yaml-route example snippets


\Cake\Routing\Router::scope('/', [], function ($routes) {
	$routes->fallbacks('DashedRoute');
});

\Cake\Core\Plugin::routes();

\Cake\Routing\Router::plugin('PluginCars', ['path' => '/cars'], function ($routes) {
  $routes->extensions(['0' => 'json', '1' => 'xml']);
  $routes->connect('/', ['plugin' => 'PluginCars', 'controller' => 'Cars', 'action' => 'index'], ['_name' => 'cars']);
  $routes->connect('/bmws', ['controller' => 'Bmws'], ['_name' => 'bmws_list']);
  $routes->connect('/bmws/:id', ['_method' => 'GET', 'controller' => 'Bmws', 'action' => 'view'], ['_name' => 'bmws_view', 'pass' => ['0' => 'id'], 'id' => '[0-9]+']);
  $routes->connect('/bmws/add', ['_method' => 'POST', 'controller' => 'Bmws', 'action' => 'add'], ['_name' => 'bmws_add']);
  $routes->connect('/ladas', ['controller' => 'Ladas'], ['_name' => 'ladas']);
  $routes->fallbacks('DashedRoute');
});

\Cake\Core\Plugin::routes();
config/routes.php
makallio85\YamlRoute\Generator::getInstance()->run(true)