1. Go to this page and download the library: Download samuelmwangiw/linode 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/ */
use SamuelMwangiW\Linode\Facades\Linode;
// Get your account details
Linode::account();
// List created Firewalls
Linode::firewall()->list();
// Get a Firewall rule
Linode::firewall()->show(123456);
// Delete a Firewall and its rules
Linode::firewall()->destroy(123456);
// Get all rules attached to a Firewall
Linode::firewall()->rules()->show(123456);
// Get available images
Linode::images()->list();
$image = [
'disk_id' => 67890123,
'label' => 'backup_disk',
'description' => 'Created in tests, delete',
];
// Create image from disk
Linode::images()->create($disk);
// show an image
Linode::images()->show(12345678);
// Delete a user created image
Linode::images()->destroy(12345678);
// List of available instances
Linode::instance()->list();
// Get an instance details
Linode::instance()->show(654321);
// Get list of disks attached to an instance
Linode::instance()->disks(654321);
$instance = [
'authorized_keys' => ['ssh-rsa yourverysecuresshpublickeywhoseprivatekeywillneverbeleakedontheinternetandfilepermissionsarepermanentlysetto0600='],
'authorized_users' => ['unicorn'],
'region' => 'eu-west',
'image' => 'linode/ubuntu22.04',
'private_ip' => true,
'label' => 'unicorn-worker-42',
'root_pass' => fake()->password(),
'type' => 'g6-nanode-1',
'watchdog_enabled' => true,
'tags' => ['workers', 'to-the-moon'],
];
// Create a linode instance
Linode::instance()->create($instance);
// Update an instance details
Linode::instance()
->update(654321, ['label'=> 'mars-rover','tags'=>['mars-colony']]);
// Clone a Linode instance
Linode::instance()
->clone(654321,['label'=>'mars-rover-02','tags'=>['test']]);
// Nuke 💣 an instance
Linode::instance()->destroy(654321);
// Shutdown an instance
Linode::instance()->shutdown(654321);
// List available Linode plans
Linode::billing()->plans();
// List of available regions
Linode::region()->list();