3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Request { const METHOD_GET = 'GET'; const METHOD_POST = 'POST'; const METHOD_HEAD = 'HEAD'; const METHOD_PUT = 'PUT'; } $routes = array( '/product-list' => [ Request::METHOD_GET => [ 'alias' => 'catalog_product_list', 'controller' => 'Handel\Catalog\Controller\Product\ProductListController::class', 'method' => 'indexAction', 'requirements' => [], 'options' => [] ] ], '/product/{slug}' => [ Request::METHOD_GET => [ 'alias' => 'catalog_product', 'controller' => 'Handel\Catalog\Controller\Product\ProductController::class', 'method' => 'indexAction' ] ], '/compare' => [ Request::METHOD_GET => [ 'alias' => 'catalog_compare_index', 'controller' => 'Handel\Catalog\Controller\Product\CompareController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_compare_add', 'controller' => 'Handel\Catalog\Controller\Product\CompareController::class', 'method' => 'postAction' ] ], '/category-list' => [ Request::METHOD_GET => [ 'alias' => 'catalog_category_list', 'controller' => 'Handel\Catalog\Controller\Product\CategoryListController::class', 'method' => 'indexAction' ] ], '/category/{slug}' => [ Request::METHOD_GET => [ 'alias' => 'catalog_category', 'controller' => 'Handel\Catalog\Controller\Product\CategoryController::class', 'method' => 'indexAction' ] ], '/manufacturer-list' => [ Request::METHOD_GET => [ 'alias' => 'catalog_manufacturer_list', 'controller' => 'Handel\Catalog\Controller\Product\ManufacturerListController::class', 'method' => 'indexAction' ] ], '/manufacturer/{slug}' => [ Request::METHOD_GET => [ 'alias' => 'catalog_manufacturer', 'controller' => 'Handel\Catalog\Controller\Product\ManufacturerController::class', 'method' => 'indexAction' ] ], '/information-list' => [ Request::METHOD_GET => [ 'alias' => 'catalog_information_list', 'controller' => 'Handel\Catalog\Controller\Information\InformationListController::class', 'method' => 'indexAction' ] ], '/information/{slug}' => [ Request::METHOD_GET => [ 'alias' => 'catalog_information', 'controller' => 'Handel\Catalog\Controller\Information\InformationController::class', 'method' => 'indexAction' ] ], '/terms-and-conditions' => [ Request::METHOD_GET => [ 'alias' => 'catalog_terms', 'controller' => 'Handel\Catalog\Controller\Information\TermsController::class', 'method' => 'indexAction' ] ], '/about-us' => [ Request::METHOD_GET => [ 'alias' => 'catalog_about', 'controller' => 'Handel\Catalog\Controller\Information\AboutController::class', 'method' => 'indexAction' ] ], '/search' => [ Request::METHOD_GET => [ 'alias' => 'catalog_search', 'controller' => 'Handel\Catalog\Controller\Product\SearchController::class', 'method' => 'indexAction' ] ], '/account' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_account', 'controller' => 'Handel\Catalog\Controller\Account\AccountController::class', 'method' => 'indexAction' ] ], '/account/address' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_address_book', 'controller' => 'Handel\Catalog\Controller\Account\AddressBookController::class', 'method' => 'indexAction' ] ], '/account/address/{id}' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_address', 'controller' => 'Handel\Catalog\Controller\Account\AddressController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_account_address', 'controller' => 'Handel\Catalog\Controller\Account\AddressController::class', 'method' => 'postAction' ], ], '/account/forgotten' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_forgotten', 'controller' => 'Handel\Catalog\Controller\Account\ForgottenController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_account_forgotten_post', 'controller' => 'Handel\Catalog\Controller\Account\ForgottenController::class', 'method' => 'postAction' ], ], '/account/login' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_login', 'controller' => 'Handel\Catalog\Controller\Account\LoginController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_account_login_post', 'controller' => 'Handel\Catalog\Controller\Account\LoginController::class', 'method' => 'postAction' ] ], '/account/logout' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_logout', 'controller' => 'Handel\Catalog\Controller\Account\LogoutController::class', 'method' => 'indexAction' ] ], '/account/newsletter' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_newsletter', 'controller' => 'Handel\Catalog\Controller\Account\NewsletterController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_account_newsletter_post', 'controller' => 'Handel\Catalog\Controller\Account\NewsletterController::class', 'method' => 'postAction' ], ], '/account/register' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_register', 'controller' => 'Handel\Catalog\Controller\Account\RegisterController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_account_register_post', 'controller' => 'Handel\Catalog\Controller\Account\RegisterController::class', 'method' => 'postAction' ] ], '/account/order-history/{id}' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_order', 'controller' => 'Handel\Catalog\Controller\Account\OrderController::class', 'method' => 'indexAction' ] ], '/account/order-history' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_order_history', 'controller' => 'Handel\Catalog\Controller\Account\OrderHistoryController::class', 'method' => 'indexAction' ] ], '/account/wishlist' => [ Request::METHOD_GET => [ 'alias' => 'catalog_account_wishlist', 'controller' => 'Handel\Catalog\Controller\Account\WishListController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_account_wishlist_post', 'controller' => 'Handel\Catalog\Controller\Account\WishListController::class', 'method' => 'postAction' ] ], '/affiliate/login' => [ Request::METHOD_GET => [ 'alias' => 'catalog_affiliate_login', 'controller' => 'Handel\Catalog\Controller\Affiliate\LoginController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_affiliate_login_post', 'controller' => 'Handel\Catalog\Controller\Affiliate\LoginController::class', 'method' => 'postAction' ], ], '/affiliate/register' => [ Request::METHOD_GET => [ 'alias' => 'catalog_affiliate_register', 'controller' => 'Handel\Catalog\Controller\Affiliate\RegisterController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_affiliate_register_post', 'controller' => 'Handel\Catalog\Controller\Affiliate\RegisterController::class', 'method' => 'postAction' ] ], '/cart' => [ Request::METHOD_GET => [ 'alias' => 'catalog_cart', 'controller' => 'Handel\Catalog\Controller\Common\CartController::class', 'method' => 'indexAction' ], Request::METHOD_POST => [ 'alias' => 'catalog_cart_post', 'controller' => 'Handel\Catalog\Controller\Common\CartController::class', 'method' => 'postAction' ] ], '/checkout' => [ Request::METHOD_GET => [ 'alias' => 'catalog_checkout', 'controller' => 'Handel\Catalog\Controller\Checkout\CheckoutController::class', 'method' => 'indexAction' ] ], '/checkout/payment-address' => [ Request::METHOD_GET => [ 'alias' => 'catalog_checkout_payment_address', 'controller' => 'Handel\Catalog\Controller\Checkout\BillingAddressController::class', 'method' => 'indexAction' ] ], '/checkout/shipping-address' => [ Request::METHOD_GET => [ 'alias' => 'catalog_checkout_delivery_address', 'controller' => 'Handel\Catalog\Controller\Checkout\ShippingAddressController::class', 'method' => 'indexAction' ] ], '/checkout/shipping-method' => [ Request::METHOD_GET => [ 'alias' => 'catalog_checkout_delivery_method', 'controller' => 'Handel\Catalog\Controller\Checkout\ShippingMethodController::class', 'method' => 'indexAction' ] ], '/' => [ Request::METHOD_GET => [ 'alias' => 'catalog_index', 'controller' => 'Handel\Catalog\Controller\Common\HomeController::class', 'method' => 'indexAction' ] ], ); $output = []; foreach ($routes as $path => $data) { foreach ($data as $http_method => $values) { $alias = $values['alias']; $controller = $values['controller']; $method = $values['method']; $output[$alias] = [ 'path' => $path, 'controller' => [$controller, $method], 'requirements' => [], 'defaults' => [], 'methods' => [$http_method] ]; } } foreach ($output as $alias => $values) { echo "\t'" . $alias . "' => [" . PHP_EOL; echo "\t\t'path' => '" . $values['path'] . "'," . PHP_EOL; echo "\t\t'controller' => '[" . $values['controller'][0] . "', '" . $values['controller'][1] . "']," . PHP_EOL; echo "\t\t'requirements' => []," . PHP_EOL; echo "\t\t'defaults' => []," . PHP_EOL; echo "\t\t'methods' => [" . $values['methods'][0] . "]," . PHP_EOL; echo "\t]," . PHP_EOL; }
based on 7T32a
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
'catalog_product_list' => [ 'path' => '/product-list', 'controller' => '[Handel\Catalog\Controller\Product\ProductListController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_product' => [ 'path' => '/product/{slug}', 'controller' => '[Handel\Catalog\Controller\Product\ProductController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_compare_index' => [ 'path' => '/compare', 'controller' => '[Handel\Catalog\Controller\Product\CompareController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_compare_add' => [ 'path' => '/compare', 'controller' => '[Handel\Catalog\Controller\Product\CompareController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_category_list' => [ 'path' => '/category-list', 'controller' => '[Handel\Catalog\Controller\Product\CategoryListController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_category' => [ 'path' => '/category/{slug}', 'controller' => '[Handel\Catalog\Controller\Product\CategoryController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_manufacturer_list' => [ 'path' => '/manufacturer-list', 'controller' => '[Handel\Catalog\Controller\Product\ManufacturerListController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_manufacturer' => [ 'path' => '/manufacturer/{slug}', 'controller' => '[Handel\Catalog\Controller\Product\ManufacturerController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_information_list' => [ 'path' => '/information-list', 'controller' => '[Handel\Catalog\Controller\Information\InformationListController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_information' => [ 'path' => '/information/{slug}', 'controller' => '[Handel\Catalog\Controller\Information\InformationController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_terms' => [ 'path' => '/terms-and-conditions', 'controller' => '[Handel\Catalog\Controller\Information\TermsController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_about' => [ 'path' => '/about-us', 'controller' => '[Handel\Catalog\Controller\Information\AboutController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_search' => [ 'path' => '/search', 'controller' => '[Handel\Catalog\Controller\Product\SearchController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_account' => [ 'path' => '/account', 'controller' => '[Handel\Catalog\Controller\Account\AccountController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_address_book' => [ 'path' => '/account/address', 'controller' => '[Handel\Catalog\Controller\Account\AddressBookController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_address' => [ 'path' => '/account/address/{id}', 'controller' => '[Handel\Catalog\Controller\Account\AddressController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_account_forgotten' => [ 'path' => '/account/forgotten', 'controller' => '[Handel\Catalog\Controller\Account\ForgottenController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_forgotten_post' => [ 'path' => '/account/forgotten', 'controller' => '[Handel\Catalog\Controller\Account\ForgottenController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_account_login' => [ 'path' => '/account/login', 'controller' => '[Handel\Catalog\Controller\Account\LoginController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_login_post' => [ 'path' => '/account/login', 'controller' => '[Handel\Catalog\Controller\Account\LoginController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_account_logout' => [ 'path' => '/account/logout', 'controller' => '[Handel\Catalog\Controller\Account\LogoutController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_newsletter' => [ 'path' => '/account/newsletter', 'controller' => '[Handel\Catalog\Controller\Account\NewsletterController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_newsletter_post' => [ 'path' => '/account/newsletter', 'controller' => '[Handel\Catalog\Controller\Account\NewsletterController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_account_register' => [ 'path' => '/account/register', 'controller' => '[Handel\Catalog\Controller\Account\RegisterController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_register_post' => [ 'path' => '/account/register', 'controller' => '[Handel\Catalog\Controller\Account\RegisterController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_account_order' => [ 'path' => '/account/order-history/{id}', 'controller' => '[Handel\Catalog\Controller\Account\OrderController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_order_history' => [ 'path' => '/account/order-history', 'controller' => '[Handel\Catalog\Controller\Account\OrderHistoryController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_wishlist' => [ 'path' => '/account/wishlist', 'controller' => '[Handel\Catalog\Controller\Account\WishListController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_account_wishlist_post' => [ 'path' => '/account/wishlist', 'controller' => '[Handel\Catalog\Controller\Account\WishListController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_affiliate_login' => [ 'path' => '/affiliate/login', 'controller' => '[Handel\Catalog\Controller\Affiliate\LoginController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_affiliate_login_post' => [ 'path' => '/affiliate/login', 'controller' => '[Handel\Catalog\Controller\Affiliate\LoginController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_affiliate_register' => [ 'path' => '/affiliate/register', 'controller' => '[Handel\Catalog\Controller\Affiliate\RegisterController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_affiliate_register_post' => [ 'path' => '/affiliate/register', 'controller' => '[Handel\Catalog\Controller\Affiliate\RegisterController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_cart' => [ 'path' => '/cart', 'controller' => '[Handel\Catalog\Controller\Common\CartController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_cart_post' => [ 'path' => '/cart', 'controller' => '[Handel\Catalog\Controller\Common\CartController::class', 'postAction'], 'requirements' => [], 'defaults' => [], 'methods' => [POST], ], 'catalog_checkout' => [ 'path' => '/checkout', 'controller' => '[Handel\Catalog\Controller\Checkout\CheckoutController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_checkout_payment_address' => [ 'path' => '/checkout/payment-address', 'controller' => '[Handel\Catalog\Controller\Checkout\BillingAddressController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_checkout_delivery_address' => [ 'path' => '/checkout/shipping-address', 'controller' => '[Handel\Catalog\Controller\Checkout\ShippingAddressController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_checkout_delivery_method' => [ 'path' => '/checkout/shipping-method', 'controller' => '[Handel\Catalog\Controller\Checkout\ShippingMethodController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ], 'catalog_index' => [ 'path' => '/', 'controller' => '[Handel\Catalog\Controller\Common\HomeController::class', 'indexAction'], 'requirements' => [], 'defaults' => [], 'methods' => [GET], ],