wefabric/acronis-laravel

Acronis API implementation for Laravel

v0.1.2 2022-11-14 09:45 UTC

This package is auto-updated.

Last update: 2024-05-14 17:12:11 UTC


README

Simple implementation of the Acronis PHP library within Laravel

Installation

composer require wefabric/acronis-laravel

Usage

Register a third-party application as an API client via the management console of the cloud platform in Acronis. Copy the domain, client id and client secret and set them in the environment file as followed:

ACRONIS_URL=
ACRONIS_CLIENT_ID=
ACRONIS_CLIENT_SECRET=

Then it is possible to call the API as followed

    use Wefabric\Acronis\AcronisClient;
    use Wefabric\Acronis\UrlResolver;
    use Wefabric\AcronisLaravel\CachedCredentials;

    $credentials = CachedCredentials::make(config('acronis.client_id'), config('acronis.client_secret'));
    $urlResolver = new UrlResolver(config('acronis.domain_url'));

    $acronis = new AcronisClient($urlResolver, $credentials);
    $alertsResponse = $acronis->getClient()->get('/api/alert_manager/v1/alerts');

    $alertsResponse->json();

Config

To publish the config file, run the following command

php artisan vendor:publish --provider="Wefabric\AcronisLaravel\Providers\AcronisLaravelServiceProvider"

License

Wefabric Acronis Laravel is open-sourced software licensed under the MIT license.