PHP code example of abdullahfaqeir / laravel-dynamic-servers-vultr

1. Go to this page and download the library: Download abdullahfaqeir/laravel-dynamic-servers-vultr library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abdullahfaqeir / laravel-dynamic-servers-vultr example snippets


return [
    'providers' => [
        'vultr' => [
            'class' => AbdullahFaqeir\LaravelDynamicServersVultr\Vultr\VultrServerProvider::class,
            'maximum_servers_in_account' => 15,
            'options' => [
                'token' => env('VULTR_TOKEN'),
                'region' => env('VULTR_REGION'),
            ],
        ],
    ],
];

public function register()
{
    ....
    
    
    $vultrServer = ServerType::new('small')
        ->provider('vultr')
        ->configuration(function (Server $server) {
            return [
                'label' => Str::slug($server->name),
                "region" => $server->option('region'),
                'plan' => 'vc2-1c-1gb',
                "vpc_uuid" => '62420e18-5628-4f6c-9ee4-aca48a5a7c17',
                'os_id' => 1743,
                'enable_ipv6' => true,
                'backups' => 'disabled',
                'tags' => [
                    'tag1',
                    'tag2'
                ]
            ];
        });

    DynamicServers::registerServerType($vultrServer);
}

protected $listen = [
        ServerRunningEvent::class => [
            UpdateServerMeta::class,
        ],
    ];
bash
php artisan dynamic-servers-vultr:install