PHP code example of xp-framework / scriptlet
1. Go to this page and download the library: Download xp-framework/scriptlet 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/ */
xp-framework / scriptlet example snippets
namespace com\example\web;
class HelloScriptlet extends \scriptlet\HttpScriptlet {
/**
* Perform GET request
*
* @param scriptlet.Request $request
* @param scriptlet.Response $response
* @throws scriptlet.ScriptletException
*/
public function doGet($request, $response) {
$response->write(sprintf('<!DOCTYPE html>
<html>
<head><title>Hello World scriptlet</title></head>
<body>
<h1>Hello %s</h1>
</body>
</html>',
htmlspecialchars($request->getParam('name', 'World'))
));
}
}