|
|
|
# Titan II
|
|
|
|
|
|
|
|
Composer / PHP 8 library for [Gemini Protocol](https://geminiprotocol.net)
|
|
|
|
|
|
|
|
Simply create online server with native IPv6 support for PHP apps or just static `gemtext`
|
|
|
|
|
|
|
|
## Integrations
|
|
|
|
|
|
|
|
* [β-Doku](https://github.com/YGGverse/bdoku) - DokuWiki Satellite for Gemini Protocol
|
|
|
|
* [Pulsar](https://github.com/YGGverse/Pulsar) - RSS Aggregator with build-in Titan-II server
|
|
|
|
* [KVAZAR](https://github.com/kvazar-network/geminiapp) - KevaCoin Content Explorer
|
|
|
|
* [KevaChat](https://github.com/kevachat/geminiapp) - Chat in KevaCoin BlockChain
|
|
|
|
|
|
|
|
## Install
|
|
|
|
|
|
|
|
1. `composer require yggverse/titan-ii`
|
|
|
|
2. `openssl req -x509 -newkey rsa:4096 -keyout key.rsa -out cert.pem -days 1 -nodes -subj "/CN=IP"`
|
|
|
|
3. `php server.php`
|
|
|
|
4. `gemini://[IP]`
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
``` php
|
|
|
|
<?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);
|
|
|
|
```
|