Gemini Protocol library for PHP 8
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
867 B

4 years ago
# Titan II
Gemini Protocol library for PHP 8
4 years ago
- [gemini://gemini.circumlunar.space/](gemini://gemini.circumlunar.space/)
- [https://gemini.circumlunar.space/](https://gemini.circumlunar.space/)
## Install
1. `composer require yggverse/titan-ii`
2. `openssl req -x509 -newkey rsa:4096 -keyout key.rsa -out cert.pem -days 3650 -nodes -subj "/CN=127.0.0.1"`
3. `php server.php`
4. `gemini://127.0.0.1`
## Usage
4 years ago
```
<?php
$server = new \YGGverse\TitanII\Server();
4 years ago
$server->setCert('cert.pem');
$server->setKey('key.rsa');
$server->setHandler(
function (\YGGverse\TitanII\Request $request): \YGGverse\TitanII\Response
{
$response = new \YGGverse\TitanII\Response();
4 years ago
$response->setCode(20);
$response->setMeta('text/plain');
$response->setContent('Hello World!');
4 years ago
return $response;
}
);
4 years ago
$server->start();
```