1. Go to this page and download the library: Download scriptotek/alma-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
scriptotek / alma-client example snippets
use Scriptotek\Alma\Client as AlmaClient;
use Scriptotek\Sru\Client as SruClient;
$alma = new AlmaClient('MY_SECRET_API_KEY', 'eu');
$bib = $alma->bibs->get('9901140123047044111');
try {
echo $bib->title;
} catch (\Scriptotek\Alma\Exception\ResourceNotFound $exc) {
// Handle the case when the record doesn't exist
}
$bib = $alma->bibs->get('9901140123047044111');
if (!$bib->exists()) {
// Handle the case when the record doesn't exist
}
namespace App\Providers;
use Http\Client\Common\Plugin\ContentLengthPlugin;
use Http\Client\Common\Plugin\ErrorPlugin;
use Http\Client\Common\Plugin\RetryPlugin;
use Http\Client\Common\PluginClient;
use Http\Factory\Discovery\HttpClient;
use Illuminate\Support\ServiceProvider;
use Psr\Http\Client\ClientInterface;
class HttpServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton(ClientInterface::class, function($app) {
return new PluginClient(
HttpClient::client(),
[
new ContentLengthPlugin(),
new RetryPlugin([
'retries' => 10,
]),
new ErrorPlugin(),
]
);
});
}
}
$bib = $alma->bibs->get('990114012304702204'); // a Bib object
$bib->record->subjects->add([
'term' => 'Boating with cats',
'vocabulary' => noubomn'
]);
$bib->save()
$bib = new Bib();
$alma->bibs->store($bib);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.