mohammadv184/arvancloud-laravel

Laravel Package for the ArvanCloud API

v1.0.0 2021-07-29 12:50 UTC

This package is auto-updated.

Last update: 2024-11-11 04:50:44 UTC


README

ArvanCloud

Laravel ArvanCloud API

Latest Stable Version Total Downloads Latest Unstable Version Build Status License

Laravel Package for the ArvanCloud API. This package supports PHP 7.3+.

For PHP integration you can use mohammadv184/arvancloud package.

List of contents

List of services

Install

Via Composer

composer require mohammadv184/arvancloud-laravel

Configure

If you are using Laravel 5.5 or higher then you don't need to add the provider and alias. (Skip to b)

a. In your config/app.php file add these two lines.

// In your providers array.
'providers' => [
    ...
    Mohammadv184\ArvanCloud\Laravel\ArvanCloudServiceProvider::class,
],

// In your aliases array.
'aliases' => [
    ...
    'CDN' => Mohammadv184\ArvanCloud\Laravel\ArvanCloudServiceProvider::class,
],

b. then run php artisan vendor:publish to publish config/arvancloud.php file in your config directory.

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'=> [...],
    ],
    ...
]
    ...   

How to use service

How to use ArvanCloud Services.

CDN

before doing any thing you need a domain in ArvanCloud CDN

In your code, use it like the below:

...
// Using Cdn Service
CDN::domain('your_domain.com')->get();

// more Example
// 1
CDN::domain()->get('your_domain.com');
// 2 
CDN::domain()->all();
// 3
CDN::cache('your_domain.com')->purge();
// 4
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

License

The MIT License (MIT). Please see License File for more information.