承接 mcpuishor/linode-laravel 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mcpuishor/linode-laravel

最新稳定版本:v0.2.1

Composer 安装命令:

composer require mcpuishor/linode-laravel

包简介

A Laravel 12 package for Linode integration

README 文档

README

A Laravel 12 package for Linode integration. For now, only Compute Instances and Managed Databases are supported.

Other features may be added in the future.

Tests

Installation

You can install the package via composer:

composer require mcpuishor/linode-laravel

Configuration

Publish the configuration file:

php artisan vendor:publish --tag="linode-config"

This will publish a linode.php configuration file to your config directory.

Add your Linode API key to your .env file:

LINODE_API_KEY=your-api-key

Usage

There are three ways to get the LinodeClient instance:

// 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();

Working with Instances

// 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);

Database Support

// 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);

Note: You must select a database engine (mysql or postgresql) before performing operations. Attempting operations without selecting an engine will throw an exception.

Advanced Usage

If you need more direct access to the Linode API, you can use the Transport class:

// Get the Transport instance
$transport = app(\Mcpuishor\LinodeLaravel\Transport::class);

// Make a custom API request
$result = $transport->get('some/endpoint');

Testing

Run the tests:

composer test

Run the tests with coverage report:

composer test:coverage

License

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

统计信息

  • 总下载量: 37
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固