PHP code example of yggverse / titan-ii
1. Go to this page and download the library: Download yggverse/titan-ii 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/ */
yggverse / titan-ii example snippets
php
$server = new \Yggverse\TitanII\Server();
$server->setCert('cert.pem');
$server->setKey('key.rsa');
$server->setHandler(
function (\Yggverse\TitanII\Request $request): \Yggverse\TitanII\Response
{
$response = new \Yggverse\TitanII\Response();
$response->setCode(20);
$response->setMeta('text/plain');
$response->setContent('Hello World!');
return $response;
}
);
$server->start('IP', 1965);