1. Go to this page and download the library: Download mcpuishor/linode-laravel 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/ */
mcpuishor / linode-laravel example snippets
// Method 1: Using the static make() method
$linode = \Mcpuishor\LinodeLaravel\LinodeClient::make();
// Method 2: Resolving from the container
$linode = app(\Mcpuishor\LinodeLaravel\LinodeClient::class);
// Method 3: Using the static service methods directly
// This leverages the __callStatic magic method
$instances = \Mcpuishor\LinodeLaravel\LinodeClient::instances()->all();
$databases = \Mcpuishor\LinodeLaravel\LinodeClient::databases()->mysql()->all();
$regions = \Mcpuishor\LinodeLaravel\LinodeClient::regions()->all();
// Method 1: Using a LinodeClient instance
$instances = $linode->instances()->all();
// Method 2: Using the static method directly
$instances = \Mcpuishor\LinodeLaravel\LinodeClient::instances()->all();
// Get a specific instance by ID
$instance = $linode->instances()->get(123);
// Create a new instance
$newInstance = $linode->instances()->create([
'label' => 'my-new-instance',
'region' => 'us-east',
'type' => 'g6-standard-1',
'image' => 'linode/ubuntu22.04',
]);
// Update an instance
$updatedInstance = $linode->instances()->update(123, [
'label' => 'updated-instance',
'region' => 'us-west',
]);
// Delete an instance
$result = $linode->instances()->delete(123);
// Method 1: Using a LinodeClient instance
$databases = $linode->databases()->all();
// Method 2: Using the static method directly
$databases = \Mcpuishor\LinodeLaravel\LinodeClient::databases()->all();
// You must select a database engine (MySQL or PostgreSQL) before performing operations
// Get a specific MySQL database by ID
$database = $linode->databases()->mysql()->get(123);
// Get a specific PostgreSQL database by ID
$database = $linode->databases()->postgresql()->get(123);
// Create a new MySQL database
$newDatabase = $linode->databases()->mysql()->create([
'label' => 'my-new-database',
'region' => 'us-east',
'type' => 'g6-standard-1',
'engine_version' => '8.0.26',
'cluster_size' => 3,
'encrypted' => true,
]);
// Update a MySQL database
$updatedDatabase = $linode->databases()->mysql()->update(123, [
'label' => 'updated-database',
'allow_list' => ['192.0.2.1/32'],
]);
// Delete a MySQL database
$result = $linode->databases()->mysql()->delete(123);
// Suspend a MySQL database
$result = $linode->databases()->mysql()->suspend(123);
// Resume a suspended MySQL database
$result = $linode->databases()->mysql()->resume(123);
// Get the Transport instance
$transport = app(\Mcpuishor\LinodeLaravel\Transport::class);
// Make a custom API request
$result = $transport->get('some/endpoint');