1. Go to this page and download the library: Download armor/framework 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/ */
// Handles a GET request for "/path/to"
$app->get('/path/to', function() {
//...
});
// Handles a POST request for "/path/to"
$app->post('/path/to', function() {
//...
});
$app = new Armor\Application();
$app->get('/', function(Request $req, Response $res) {
$res->append("<html>
<body>
<h1>Hello, World!</h1>
<p>This is an example page, and you are accessing {$req->path->absolute}</p>
</body>
</html>");
return $res->end();
});
$app->run();
/**
* This example is a snippet taken and adapted from the 'example01', available at https://github.com/14mPr0gr4mm3r/armor-examples
* @author 14mPr0gr4mm3r
* @license MIT
*/
$templ = new ArmorUI\TemplateManager("./", ['header', 'index']);
$app->get('/', function(Request $req, Response $res) use($templ) {
$templ->getTemplate('index')->sendAsResponse($res);
return $res->end();
});