mohammadv184 / arvancloud
PHP library for the ArvanCloud API
Requires
- php: ^7.3|^8.0
- ext-json: *
- guzzlehttp/guzzle: ^7.3
- nesbot/carbon: ^2.50
Requires (Dev)
- mockery/mockery: ^1.4
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: 3.*
Suggests
- mohammadv184/arvancloud-laravel: Laravel Package for the ArvanCloud API
README
PHP ArvanCloud API
PHP library for the ArvanCloud API.
This package supports PHP 7.3+
.
For Laravel integration you can use mohammadv184/arvancloud-laravel package.
List of contents
List of services
Install
Via Composer
composer require mohammadv184/arvancloud
Configure
a. Copy config/arvancloud.php
into somewhere in your project. (you can also find it in vendor/mohammadv184/arvancloud/config/arvancloud.php
path).
b. In the config file you can set the Config to be used for all your Service and you can also change the Config at runtime.
Choose what Authentication type you would like to use in your application.
'auth'=> [ 'default' => 'ApiKey', //Set default Auth Type 'UserToken'=> '', 'ApiKey' => '',//User API Key available in arvancloud panel ], ...
Then fill the credentials for that Service in the services array.
'services' => [ 'cdn' => [ 'baseUrl' => 'https://napi.arvancloud.com/cdn/4.0/', 'domain' => 'your_domain.com',// Fill in the credentials here. 'endpoints'=> [...], ], ... ] ...
c. Instantiate the ArvanCloud
class and pass configs to it like the below:
use Mohammadv184\ArvanCloud\ArvanCloud; // load the config file from your project $config = require('path/to/arvancloud.php'); $arvanCloud= new ArvanCloud($config);
How to use service
How to use ArvanCloud Services.
CDN
before doing any thing you need ArvanCloud Class
In your code, use it like the below:
// At the top of the file. use Mohammadv184\ArvanCloud\ArvanCloud; ... // Create new ArvanCloud. $arvanCloud = new ArvanCloud($config); // Using Cdn Service $arvanCloud->cdn()->domain('your_domain.com')->get(); // more Example // 1 $arvanCloud->cdn()->domain()->get('your_domain.com'); // 2 $arvanCloud->cdn()->domain()->all(); // 3 $arvanCloud->cdn()->cache('your_domain.com')->purge(); // 4 $arvanCloud->cdn()->dns()->delete('Dns_id','your_domain.com') ->getMessage();
Available methods:
domain
:all()
: get all domainscreate(string $domain)
: Create New Domain.get(string $domain = null)
: Get Domain Settingsdelete(string $domain = null)
: Delete Domain.
cache
:get(string $domain = null)
: Get Domain Cache settings.update(array $data, string $domain = null)
: Update Domain Cache settings.purge(array $urls = null, string $domain = null)
: Purge Domain Cache.
dns
:all()
: Get All Domain Dns.create(string $domain)
: Create new Domain Dns.get(string $domain = null)
: Get Domain Dns Settings.update(string $id, array $data, string $domain = null)
: Update Domain Dns Settings.delete(string $domain = null)
: Delete Domain Dns.cloud(string $id, bool $status = true, string $domain = null)
: Update Domain Dns Cloud Status.import($zoneFile, string $domain = null)
: Import DNS records using BIND file
ssl
:get(string $domain = null)
: Get Domain Ssl Settings.update(string $sslType, string $domain = null)
: Update Domain Ssl Settings.
Credits
License
The MIT License (MIT). Please see License File for more information.