PHP 8 Library for Gemini Protocol
For optimization reasons, some experimental features like Dokuwiki
and GTK3/Pango
was dropped from 1.0.0
release, but available in previous versions. Gemtext
component re-implemented as separated library (see Extras)
- gemtext-php - Object-oriented PHP 8 library for Gemini / Gemtext operations
composer require yggverse/gemini
PHP interface for Gemini protocol queries by TLS socket connection
$request = new \Yggverse\Gemini\Client\Request(
'gemini://yggverse.cities.yesterweb.org:1965/index.gmi'
);
Resolved request (SNI)
For direct connection provide resolved IP as the second argument
$request = new \Yggverse\Gemini\Client\Request(
'gemini://yggverse.cities.yesterweb.org:1965/index.gmi' // target URL
'68.133.1.71' // resolved IP, skip to use system-wide resolver
);
Alternatively, use setResolvedHost
method of Request
object before getResponse
$request->setResolvedHost(
'68.133.1.71'
)
- to resolve network address with PHP, take a look on the net-php library!
Get resolved host back
Execute requested URL and return raw response
var_dump(
$request->getResponse()
);
$request = new \Yggverse\Gemini\Client\Request(
'gemini://yggverse.cities.yesterweb.org',
'68.133.1.71' // make direct request to the resolved host
);
$request->setOptions(
[
'ssl' =>
[
'peer_name' => 'yggverse.cities.yesterweb.org', // SNI
'verify_peer' => false,
'verify_peer_name' => false
]
]
);
This class provides additional features for the raw response operations
$response = new \Yggverse\Gemini\Client\Response(
$request->getResponse()
);
var_dump(
$response->getBody()
);