spinupwp/spinupwp-php-sdk 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

spinupwp/spinupwp-php-sdk

Composer 安装命令:

composer require spinupwp/spinupwp-php-sdk

包简介

The official SpinupWP PHP SDK

关键字:

README 文档

README

Tests Total Downloads Latest Stable Version License

The SpinupWP PHP SDK provides an expressive interface for interacting with SpinupWP's API. It includes a pre-defined set of classes for API resources that initialize themselves dynamically from API responses.

Installation

To get started, require the package via Composer:

composer require spinupwp/spinupwp-php-sdk

Usage

You can create an instance of the SpinupWP client like so:

$spinupwp = new SpinupWp\SpinupWp('API_TOKEN');

Servers

// Return a collection of servers
$servers = $spinupwp->servers->list();

// Return a single server
$server = $spinupwp->servers->get($serverId);

// Create and return a new server 
$server = $spinupwp->servers->create([]);

// Create and return a new custom server 
$server = $spinupwp->servers->createCustom([]);

// Delete a server
$eventId = $spinupwp->servers->delete($serverId, $deleteOnProvider);

// Reboot a server
$eventId = $spinupwp->servers->reboot($serverId);

// Restart the Nginx service on a server
$eventId = $spinupwp->servers->restartNginx($serverId);

// Restart the Redis service on a server
$eventId = $spinupwp->servers->restartRedis($serverId);

// Restart all versions of the PHP-FPM service installed on a server
$eventId = $spinupwp->servers->restartPhp($serverId);

// Restart the MySQL or MariaDB service on a server
$eventId = $spinupwp->servers->restartMysql($serverId);

On a Server instance you may also call:

// Return a collection of this server's sites
$sites = $server->sites();

// Delete the current server
$server->delete($deleteOnProvider);

// Reboot the current server
$server->reboot();

// Restart the Nginx service on the current server
$server->restartNginx();

// Restart the Redis service on the current server
$server->restartRedis();

// Restart all versions of the PHP-FPM service installed on the current server
$server->restartPhp();

// Restart the MySQL or MariaDB service on the current server
$server->restartMysql();

Sites

// Return a collection of sites
$sites = $spinupwp->sites->list();

// Return a single site
$site = $spinupwp->sites->get($siteId);

// Create and return a new site
$site = $spinupwp->sites->create($serverId, []);

// Delete a site
$eventId = $spinupwp->sites->delete($siteId);

// Run a git deployment
$eventId = $spinupwp->sites->gitDeploy($siteId);

// Purge a site's page cache
$eventId = $spinupwp->sites->purgePageCache($siteId);

// Purge a site's object cache
$eventId = $spinupwp->sites->purgeObjectCache($siteId);

// Reset a site's file permissions
$eventId = $spinupwp->sites->correctFilePermissions($siteId);

// Enable HTTPS
$eventId = $spinupwp->sites->enableHttps($siteId, ['type' => 'webroot']);

// Update HTTPS settings
$eventId = $spinupwp->sites->updateHttps($siteId, [
    'type' => 'custom',
    'certificate' => '-----BEGIN CERTIFICATE-----...',
    'private_key' => '-----BEGIN PRIVATE KEY-----...',
]);

// Disable HTTPS
$eventId = $spinupwp->sites->disableHttps($siteId);

// Update PHP version
$eventId = $spinupwp->sites->updatePhpSettings($siteId, ['php_version' => '8.3']);

// Enable the SpinupWP subdomain
$eventId = $spinupwp->sites->enableSpinupwpSubdomain($siteId);

// Disable the SpinupWP subdomain
$eventId = $spinupwp->sites->disableSpinupwpSubdomain($siteId);

// List additional domains
$domains = $spinupwp->sites->listDomains($siteId);

// Add an additional domain
$domain = $spinupwp->sites->addDomain($siteId, [
    'domain' => 'www.turnipjuice.media',
    'redirect' => [
        'enabled' => true,
    ],
]);

// Update an additional domain
$domain = $spinupwp->sites->updateDomain($siteId, $domainId, [
    'redirect' => [
        'enabled' => true,
        'type' => 301,
        'destination' => 'turnipjuice.media',
    ],
]);

// Delete an additional domain
$eventId = $spinupwp->sites->deleteDomain($siteId, $domainId);

On a Site instance you may also call:

// Delete the current site
$site->delete();

// Run a git deployment
$site->gitDeploy();

// Purge a site's page cache
$site->purgePageCache();

// Purge a site's object cache
$site->purgeObjectCache();

// Reset a site's file permissions
$site->correctFilePermissions();

// Enable HTTPS
$site->enableHttps(['type' => 'webroot']);

// Update HTTPS settings
$site->updateHttps(['type' => 'custom', 'certificate' => '...', 'private_key' => '...']);

// Disable HTTPS
$site->disableHttps();

// Update PHP version
$site->updatePhpSettings(['php_version' => '8.3']);

// Enable the SpinupWP subdomain
$site->enableSpinupwpSubdomain();

// Disable the SpinupWP subdomain
$site->disableSpinupwpSubdomain();

// List additional domains
$site->listDomains();

// Add an additional domain
$site->addDomain(['domain' => 'www.turnipjuice.media']);

// Update an additional domain
$site->updateDomain($domainId, ['redirect' => ['enabled' => true]]);

// Delete an additional domain
$site->deleteDomain($domainId);

Events

// Return a collection of events
$events = $spinupwp->events->list();

// Return a single event
$event = $spinupwp->events->get($eventId);

SSH Key

// Return SpinupWP's SSH Public Key
$key = $spinupwp->sshKeys->get();

Resource Collections

When retrieving a list of resources, an instance of ResourceCollection is returned. This class handles fetching large lists of resources without having to paginate results and perform subsequent requests manually.

$servers = $spinupwp->servers->list();

// Return an array of all servers
$servers->toArray();

// Return the total number of servers
$servers->count();

// Lazily iterate over all servers
foreach ($servers as $server) {
    // Do something with $server
}

License

SpinupWP PHP SDK is open-sourced software licensed under the MIT license.

spinupwp/spinupwp-php-sdk 适用场景与选型建议

spinupwp/spinupwp-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8.67k 次下载、GitHub Stars 达 14, 最近一次更新时间为 2022 年 06 月 06 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「api」 「SpinupWP」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 spinupwp/spinupwp-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 spinupwp/spinupwp-php-sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 spinupwp/spinupwp-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 8.67k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

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