Download the PHP package scriptotek/sru-client without Composer
On this page you can find all versions of the php package scriptotek/sru-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download scriptotek/sru-client
More information about scriptotek/sru-client
Files in scriptotek/sru-client
Package sru-client
Short Description Package for making Search/Retrieve via URL requests and parse the responses
License MIT
Homepage http://github.com/scriptotek/sru-client
Informations about the package sru-client
php-sru-client
Simple PHP package for making Search/Retrieve via URL (SRU) requests and returning QuiteSimpleXMLElement objects. The response object is an iterator, to support easy iteration over the results, abstracting away the process of making multiple requests.
If you prefer a simple text response, you might have a look at the php-sru-search package.
Install using Composer
Use Composer to install sru-client with a HTTP library such as Guzzle:
We use HTTP discovery to discover HTTP client and HTTP factory implementations, so Guzzle can be swapped with any other PSR-17/PSR-18-compatible library.
Configuring the client
Search and retrieve
To get all the records matching a given CQL query:
where $record
is an instance of QuiteSimpleXMLElement.
The all()
method takes care of continuation for you under the hood for you;
the Records generator
continues to fetch records until the result set is depleted. A default batch size of 10 is used,
but you can give any number supported by the server as a second argument to the all()
method.
If you query for some identifier, you can use the convenience method first()
:
The result is a Record
object, or null
if not found.
Use explain to get information about servers
Laravel 5 integration
Add the service provider to the 'providers'
array in config/app.php
:
Scriptotek\Sru\Providers\SruServiceProvider::class,
Optionally, add the facade to the 'aliases'
array in the same file:
'SruClient' => Scriptotek\Sru\Facades\SruClient::class,
To create the configuration file config/sru.php
:
$ php artisan vendor:publish --provider="Scriptotek\Sru\Providers\SruServiceProvider"
All versions of sru-client with dependencies
psr/http-client-implementation Version ^1.0
psr/http-factory-implementation Version ^1.0
http-interop/http-factory-discovery Version ^1.4
php-http/client-common Version ^2.0