ubc/ltcommons

UBC LT Commons

0.1.1 2016-04-22 07:53 UTC

This package is not auto-updated.

Last update: 2024-04-24 12:46:42 UTC


README

Build Status

Install

composer require ubc/ltcommons

Usage

Plain PHP

require 'vendor/autoload.php';

// Bootstrap the JMS custom annotations for Object to Json mapping
\Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
    'JMS\Serializer\Annotation',
    dirname(__FILE__).'/vendor/jms/serializer/src'
);

$base_url = 'http://sisapi.example.com';
$username = 'service_username';
$password = 'service_password';

$providerFactory = new DataProviderFactory();
$providerFactory->addProvider(new SISDataProvider(
    $base_url,
    new GuzzleClient(),
    new HttpBasic($username, $password),
    new JMSSerializer()
));
$service = new DepartmentCodeService($providerFactory);
$codes = $service->getDepartmentCodes();

$student = $service->getStudentById('12345678');

Using with Symfony 2

Please checkout LtCommons bundle

Run Tests

composer install
vendor/bin/phpunit