PHP 8 Library for Gemini Protocol
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.
yggverse d8c7b0668b update readme 6 months ago
src/Client drop Dokuwiki features from future release 6 months ago
.gitignore add ASCII table support 11 months ago
LICENSE Initial commit 11 months ago
README.md update readme 6 months ago
composer.json add ASCII table support 11 months ago

README.md

gemini-php

PHP 8 Library for Gemini Protocol

Extras

  • gemtext-php - Object-oriented PHP 8 library for Gemini / Gemtext operations

Usage

composer require yggverse/gemini

Client

PHP interface for Gemini protocol queries by TLS socket connection

Request

$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

$request->setResolvedHost(
    '68.133.1.71'
)
  • to resolve network address with PHP, take a look on the net-php library!

Request::getResolvedHost

Get resolved host back

Request::setHost

Request::getHost

Request::setPort

Request::getPort

Request::setPath

Request::getPath

Request::setQuery

Request::getQuery

Request::getResponse

Execute requested URL and return raw response

var_dump(
    $request->getResponse()
);

Request::getOptions

Request::setOptions

$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
        ]
    ]
);

Response

This class provides additional features for the raw response operations

$response = new \Yggverse\Gemini\Client\Response(
    $request->getResponse()
);

Response::setCode

Response::getCode

Response::setMeta

Response::getMeta

Response::setBody

Response::getBody

var_dump(
    $response->getBody()
);

Integrations

  • gemini-dl - CLI Batch downloader for Gemini Protocol
  • Yo! - Crawler for different networks
  • Yoda - PHP-GTK browser for Gemini Protocol
  • β-Doku - DokuWiki Satellite for Gemini Protocol