PHP code example of ubc / ltcommons
1. Go to this page and download the library: Download ubc/ltcommons 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/ */
ubc / ltcommons example snippets
// 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');