Download the PHP package cyberfusion/cluster-api-client without Composer
On this page you can find all versions of the php package cyberfusion/cluster-api-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cyberfusion/cluster-api-client
More information about cyberfusion/cluster-api-client
Files in cyberfusion/cluster-api-client
Package cluster-api-client
Short Description Client for Cyberfusion Core API
License MIT
Homepage https://github.com/CyberfusionIO/cyberfusion-cluster-api-client
Informations about the package cluster-api-client
Cyberfusion Core API client
Client for the Cyberfusion Core API.
This client was built for and tested on the 1.230.1 version of the API.
Support
This client is officially supported by Cyberfusion. If you have any questions, open an issue on GitHub or email [email protected].
The client was created by @dvdheiden.
Requirements
This client requires PHP 8.1 or higher and uses Guzzle.
Installation
This client can be used in any PHP project and with any framework.
Install the client with Composer:
composer require cyberfusion/cluster-api-client
Usage
Refer to the API documentation for information about API requests.
Getting started
Requests
The endpoint methods may ask for filters, models and IDs. The method type hints tell you which input is requested.
Models
The endpoint may request a model. Most create and update requests do.
When models need to be provided, the required properties are checked before executing the request.
RequestException
is thrown when properties are missing. See the error message for more details.
Filtering data
Some endpoints require a ListFilter
and return a list of models according to the filter. It's also possible to change
the sort order.
Model filters
A ListFilter
can be initialized for a model, so it automatically validates if the provided fields are available for
the model.
Manually creating filters
You can initialize the ListFilter
manually, but fields are not validated if they are available for the model.
Or provide the entries and sort directly:
Alternative method
This package used to offer this way to build the filter. Due to backwards compatibility, this functionality is still available.
Or provide the entries and sort directly:
Manually make requests
To use the API directly, use the request()
method on the Client
. This method needs a Request
class. See the class
itself for its options.
Responses
The endpoint methods throw exceptions when requests fail due to timeouts. When the API replies with HTTP protocol
errors, the Response
class is returned nonetheless. Check if the request succeeded with: $response->isSuccess()
.
API responses are automatically converted to models.
Authentication
The API is authenticated with a username and password and returns an access token. This client takes care of authentication. To get credentials, contact Cyberfusion.
When you authenticate with username and password, this client automatically retrieves the access token.
The access token is valid for 30 minutes, so there's no need to store it. To store it anyway, access it with
$configuration->getAccessToken()
.
Manually authenticate
Enums
Some properties should contain certain values. These values can be found in the enum classes.
Exceptions
In case of errors, the client throws an exception which extends ClusterApiException
.
All exceptions have a code. These can be found in the ClusterApiException
class.
Laravel
This client can be easily used in any Laravel application. Add your API credentials to the .env
file:
Next, create a config file called cluster.php
in the config
directory:
Use those files to build the configuration:
Tests
Unit tests are available in the tests
directory. Run:
composer test
To generate a code coverage report in the build/report
directory, run:
composer test-coverage
Contribution
Contributions are welcome. See the contributing guidelines.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
This client is open-sourced software licensed under the MIT license.
All versions of cluster-api-client with dependencies
ext-json Version *
guzzlehttp/guzzle Version ^7.2
illuminate/support Version ^8.22 || ^9.0 || ^10.0 || ^11.0
nesbot/carbon Version ^2.43
ramsey/uuid Version ^3.9 || ^4.0
vdhicts/http-query-builder Version ^1.0