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
PHP ArvanCloud API List of contents List of services Install Configure How to use service CDN Credits LicenseList of services
CDN ✔️ Vod ⌛ iaas ⌛ VAds ⌛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 Mohammadv184ArvanCloudArvanCloud; // 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 Mohammadv184ArvanCloudArvanCloud; ... // 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 domains
create(string $domain)
: Create New Domain.
get(string $domain = null)
: Get Domain Settings
delete(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
Mohammad Abbasi All ContributorsLicense
The MIT License (MIT). Please see License File for more information.
版权声明:
1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。