forevue / harvester-metadata-sdk
SDK for accessing source-level and document-level metadata generated by Forevue's Crawler
dev-main
2023-06-24 17:07 UTC
Requires
- php: ^8.2
- ext-pdo: *
Requires (Dev)
- laravel/pint: ^1.10
- pestphp/pest: ^2.6
- phpstan/phpstan: ^1.10
- symfony/var-dumper: ^6
This package is not auto-updated.
Last update: 2024-04-14 18:57:11 UTC
README
Installation
Requires PHP 8.2+
You can install the package via composer:
composer require forevue/harvester-metadata-sdk
Usage
This is a cowboy-style SDK, you connect to the database directly.
Getting started
use Forevue\HarvesterMetadataSdk\Client; // This creates a PDO instance behind the scenes $client = new Client( host: 'localhost', password: 'root', port: 5432, user: 'postgres', database: 'postgres', driver: 'pgsql', ) // Or, $client = new Client(dsn: 'pgsql:...') // Or, $client = new Client(pdo: new PDO(...))
Querying
/* @var \Forevue\HarvesterMetadataSdk\Client $client */ $client->sources()->all(); $client->sources()->find(1234); $client->sources()->findByUrn('urn:forevue:source:code-hash:static-hash'); $client->providers()->all(); $client->providers()->find(1234); $client->providers()->findByUrn('urn:forevue:provider:code-hash:static-hash'); /* @var \Forevue\HarvesterMetadataSdk\DataObjects\Source $source */ $source->id(); $source->name(); // etc $source->isDirty() // this is the only computed property $source->subSources(); // returns the child sources $source->provider(); // returns the parent provider object /* @var \Forevue\HarvesterMetadataSdk\DataObjects\Provider $provider */ $provider->id(); $provider->name(); // etc $provider->sources(); // returns the provider's sources
$source->crawlInterval()
and$source->recrawlInterval()
returns an array{int, int} not an object
Testing
composer test
harvester-metadata-sdk was created by Félix Dorn under the * *MIT license**.