metmax-io / cbr-api-php
CBR Top WSAPI client wrapper
Fund package maintenance!
MetMax
Requires
- php: ^8.1
- guzzlehttp/psr7: ^2.4
- php-soap/psr18-wsse-middleware: ^2.1
- phpro/soap-client: ^2.4
- symfony/http-client: ^6.2
- vlucas/phpdotenv: ^5.5
Requires (Dev)
- laravel/pint: ^1.2
- php-http/vcr-plugin: ^1.2
- phpunit/phpunit: ^9.5
This package is not auto-updated.
Last update: 2025-03-12 18:26:45 UTC
README
A PHP wrapper for interacting with CBR Top Webservices API and supports the AuthenticationService, ReservationService, ReferenceDataService. This way you are able to handle the following operations:
- Submitting a new application or changing an existing application;
- Requesting open applications;
- Request previously purchased capacity via TOP;
- Reservation of requests at own capacity;
- Requesting the results;
- Request reference data such as the permitted products and locations, your registered instructors, your agreements with other trainers, and the available languages of the products;
- Changing the password;
Installation
You can install the package via composer:
composer require metmax-io/cbr-api-php
Create the environment file
cp .env.dist .env
Usage
The API consists of 3 endpoints:
- Authentication
- ReferenceData
- Reservation
The API's are separated in different folders but can be used similarly.
Get a list of physical CBR locations
use MetMax\Cbr\ReferenceData\ReferenceDataClientFactory; use MetMax\Cbr\ReferenceData\Type\LocationsRequest; $referenceData = ReferenceDataClientFactory::factory('username', 'password'); $locations = $referenceData->getLocations(new LocationsRequest());
Testing
The package php-http/vcr-plugin is being used to mock SOAP calls towards the CBR API. Responses will be stored inside the fixtures/vcr/ directory.
When a fixture isn't available, an actual HTTP call will be initiated, while the response will be stored as a fixture. If you want to update existing fixtures or creating new endpoints, make sure that the API credentials are configured within the .env file.
Run full testsuite
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.