dlcs / elucidate-php
Elucidate Annotation Server API for PHP
Installs: 9 215
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 4
Forks: 2
Open Issues: 2
Requires
- beberlei/assert: ^2.7
- guzzlehttp/psr7: ^1.4
- psr/http-message: ^1.0
- symfony/event-dispatcher: ^3.3
- zendframework/zend-psr7bridge: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.6
- guzzlehttp/guzzle: 6.2.*
- phpunit/phpunit: ^5.5
- zendframework/zend-http: ^2.5.4
Suggests
- guzzlehttp/guzzle: Guzzle http client for making requests
- zendframework/zend-http: Zend http client for making requests
This package is auto-updated.
Last update: 2025-02-21 21:32:13 UTC
README
Installation
composer require dlcs/elucidate-php
You will also need to install GuzzleHttp >= v6
## Usage
// Create an HTTP driver. $guzzle = new Elucidate\Adapter\GuzzleHttpAdapter( new GuzzleHttp\Client(['base_uri' => 'http://my.eluciadte.server']) ); // Create the Elucidate client. $elucidate = new Elucidate\Client($guzzle); // Create a container for storing annotations. $container = $elucidate->createContainer('My first container'); // Create an annotation. $annotation = new Elucidate\Model\Annotation(null, [ 'type' => 'TextualBody', 'value' => 'I like this page!' ], 'http://www.example.com/index.html'); // Add metaData $annotation->withMetaData([ 'creator' => 'stephen@_.com' ]); // Assign it to a container. $annotation->withContainer($container); // Create it in the server. $elucidate->createAnnotation($annotation); // Search for the annotation. $json = $elucidate->search(new Elucidate\Search\SearchByTarget(['id'], 'http://www.example.com/index.html')); // Get search result wrapper $searchResult = SearchResult::fromJson($json); // get annotations (generator) $annotations = $searchResult->getResults(); // Annotation objects // get next page ID $searchResult->getNextPage(); // Search for next page $page2 = $elucidate->search($searchResult->getNextSearchQuery()); // etc.. $searchResultPage2 = SearchResult::fromJson($page2);