reliv / axosoft-api
Module Axosift API wrapper
Installs: 3 237
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 11
Forks: 3
Open Issues: 0
Requires
- php: >=5.4
- guzzlehttp/guzzle: 6.*
Requires (Dev)
- phpunit/phpunit: 4.*
- squizlabs/php_codesniffer: 2.*
README
Description
PHP wrapper for Axosoft API
Developers
This package contains a basic framework and a class structure for wrapping the API for AxoSoft (On-Time).
Please help us finish these API classes. We have only written a limited number of classes to support our needs.
If you wish to use the API library and an API classe you require is missing, you may utilize the Generic classes to build requests.
Example of standard list call
// Get AxosoftApi from ZF2 service manager $axosoftApi = $this->getServiceLocator()->get('Reliv\AxosoftApi\Service\AxosoftApi'); // Build request $request = new ApiRequestList(); $request->setProjectId(10); $request->setSearchString('search for me'); $request->setSearchField('name'); $request->setPage(1); $request->setPageSize(1); // Get Response $response = $axosoftApi->send($request); // Handle error if ($axosoftApi->hasError($response)) { throw new \Exception('Call Failed.'); } $dataArray = $response->getResponseData(); $someValue = $response->getResponseProperty('somekey');
Example of generic list call
// Get AxosoftApi from ZF2 service manager $axosoftApi = $this->getServiceLocator()->get('Reliv\AxosoftApi\Service\AxosoftApi'); // Build request $request = new GenericApiRequest('/api/v5/items'); $request->setRequestParameter('project_id', 10); $request->setRequestParameter('search_string', 'search for me'); $request->setRequestParameter('search_field', 'name'); $request->setRequestParameter('page', 1); $request->setRequestParameter('page_size', 1); // Get Response $response = $axosoftApi->send($request); // Handle error if ($axosoftApi->hasError($response)) { throw new \Exception('Call Failed.'); } $dataArray = $response->getResponseData(); $someValue = $response->getResponseProperty('somekey');
ToDo
- Write the rest of the API classes
- Create API request validators
- May implement command pattern to simplify API calls