Makes interactions with the LibGuides v2 API using PHP 5.4.0+ even easier. There isn't much to the LibGuides 2 API yet.
php-alma
uses the Composer dependency management system. It uses GitHub as a repository now, but when it reaches some degree of stability it will be added to Packagist.
-
If you haven't already, install
composer.phar
. To installcomposer.phar
in the/usr/bin
directory on Linux/OS X:sudo curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin
-
Create a
composer.json
file. The example below will installphp-alma
:{ "name": "your-org/your-project", "description": "Describe your project", "license": "MIT", "repositories": [ { "type": "vcs", "url": "https://github.com/BCLibraries/php-libguides" } ], "require": { "bclibraries/php-libguides": "0.0.2" } }
Transitive composer installs don't work with PEAR repositories, so you'll have to specifically include the PEAR install in your
composer.json
. -
Install using
composer.phar
:php composer.phar install
Composer will load all the required dependencies and create a vendor/autoload.php
file to handle autoloading classes.
First instantiate a client:
$client = new \BCLib\LibGuides\Client('94', 'http://libguides.bc.edu');
The only active part of the LibGuides 2 API is getting guides. You can get all guides:
$guides = $client->getGuides();
or get certain guides by ID:
$guides = $client->getGuides(['44559','43982']);
See MIT-LICENSE.