christophwurst/kitinerary-sys

KItinerary binding for the system package

v0.2.1 2023-05-22 15:13 UTC

This package is auto-updated.

Last update: 2024-10-30 08:21:51 UTC


README

System executable adapter for the kitinerary extractor package. This package provides an adapter that invokes the binary installed on the system, e.g. with a Linux distribution's package manager.

Installation

composer require christophwurst/kitinerary christophwurst/kitinerary-sys

Usage

use ChristophWurst\KItinerary\ItineraryExtractor;
use ChristophWurst\KItinerary\Sys\SysAdapter;
use ChristophWurst\KItinerary\Exception\KItineraryRuntimeException;

$adapter = new SysAdapter();
if (!$adapter->isAvailable()) {
    // ...
}
$extractor = new Extractor($adapter);

try {
    $itinerary = $extractor->extractFromString('...');
} catch (KItineraryRuntimeException $e) {
    // ...
}