Lue dans les fichiers PHP du paquet au commit b9a8af5424b3 : ses espaces de noms, classes, interfaces et énumérations, leurs constantes, propriétés et méthodes publiques avec leur PHPDoc, et les options que prennent ses fabriques. Rien n’en est exécuté.
OpenLibrarySourceclassOpen Library (openlibrary.org, no key): books. An author's books - by their Open Library id or their name, every spelling of it - one record per edition, each with its ISBNs, publisher, date and cover: the Merger groups the editions of a book. A book by ISBN or Open Library id; a search; an author's page (bio, links, ORCID when given).
7 methods · 2 constants
OpenLibrarySourceFactoryclassOpen Library: books, their editions and covers - no key.
3 options
Omnischolar\OpenLibrary
OpenLibrarySource class
final class OpenLibrarySource extends HttpSource OpenLibrarySource.php:30
Open Library (openlibrary.org, no key): books. An author's books - by their Open Library id or their name, every spelling of it - one record per edition, each with its ISBNs, publisher, date and cover: the Merger groups the editions of a book. A book by ISBN or Open Library id; a search; an author's page (bio, links, ORCID when given).
Open Library asks callers to name themselves: the User-Agent carries the mailto. Its works list its editions in a second call (editions.json): a page of 25 works may cost as many calls - hence the throttle.
const BASE_URI = 'https://openlibrary.org/'const COVERS = 'https://covers.openlibrary.org/b/id/%d-L.jpg'
OpenLibrarySource::__construct()
public function __construct(HttpClientInterface $http, readonly bool $editions = true, string $baseUri = self::BASE_URI, array $headers = [], float $throttle = 0.0)OpenLibrarySource::getName()
public function getName(): stringOpenLibrarySource::capabilities()
public function capabilities(): arrayOpenLibrarySource::author()
public function author(Identifier|string $author): ?AuthorAn author by their Open Library id (OL7092953A), or the first one a name finds.
OpenLibrarySource::works()
public function works(Identifier|string $author, ?Query $query = null): PageAn author's books, one record per edition: by their Open Library id (only the books filed under it) or by their name (every author record of that name: "Monica Neagoy", "MONICA NEAGOY", "Monica M. Neagoy"...). The cursor is a page number.
OpenLibrarySource::work()
public function work(Identifier|string $id): ?WorkA book by its ISBN (that edition), its edition id (OL...M) or its work id (OL...W).
OpenLibrarySource::search()
public function search(Query $query): PageOpenLibrarySourceFactory class
final class OpenLibrarySourceFactory extends SourceFactory OpenLibrarySourceFactory.php:19
Open Library: books, their editions and covers - no key.
options: mailto: 'support@glitchr.io' # in the User-Agent, as Open Library asks of its callers editions: true # one record per edition (the Merger groups them); false: one per work throttle: 0.4 # seconds between two calls (Open Library allows about 3 a second to a named caller) base_uri: 'https://openlibrary.org/'
Options
| Option | Default | |
|---|---|---|
editions | true | |
throttle | 0.4 | |
base_uri | OpenLibrarySource::BASE_URI |