dsv-su / daisy-api-client-php
Daisy API client for PHP
Requires
- php: >=5.4.0
- giggsey/libphonenumber-for-php: ~7.0
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- phpdocumentor/phpdocumentor: ^2.8
- phpunit/phpunit: ~4.6
This package is not auto-updated.
Last update: 2024-04-13 16:18:07 UTC
README
This library can be used to access the API provided by DSV's administrative system Daisy from PHP applications.
Installation
composer require dsv-su/daisy-api-client-php '~1.0'
Usage
Create a file daisy_api.json
containing
{ "url": "https://api.dsv.su.se/rest/", "user": "nisse", "pass": "password" }
except with user and pass replaced by yours. Now you can use the library like this:
require 'vendor/autoload.php'; use DsvSu\Daisy; $employees = Daisy\Employee::find(['department' => 4]); foreach ($employees as $e) { $p = $e->getPerson(); echo $p->getFirstName() . ' ' . $p->getLastName() . "\n"; }
If daisy_api.json
exists in the current directory, it will be used
automatically. Otherwise, you can specify its location with:
Daisy\Client::initUsingConfigFile(dirname(__FILE__) . '/daisy_api.json');
Documentation
Some functions are documented in the source code using phpdoc comments. The easiest way to understand how to use the library is to read the source and look at examples, e.g. https://github.com/dsv-su/daisyweb.
Test suite
The library has a test suite which you should run before committing anything:
vendor/bin/phpunit
It is a good idea to add test cases when you modify the code.