1. Go to this page and download the library: Download troublete/monty 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/ */
troublete / monty example snippets
lication = new \Monty\Application();
$application->get(
'/request[/{someId}]',
function (\Monty\Request $req, \Monty\Response $res, $someId) {
// do some awesome stuff
return new \Symfony\Component\HttpFoundation\JsonResponse([]);
}
);
// ...
$app->handle(
['GET'],
'/index',
function ($req, $res) { /*...*/ },
function ($req, $res) { /*...*/ },
function ($req, $res) { /*...*/ }
// ...
);
// ...
// ...
$app->middleware(
\Monty\Application::PREPEND,
function ($req, $res) { /*...*/ },
function ($req, $res) { /*...*/ },
function ($req, $res) { /*...*/ }
// ...
);
// ...