承接 toorop/ovh-sdk-php 相关项目开发

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

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

toorop/ovh-sdk-php

Composer 安装命令:

composer require toorop/ovh-sdk-php

包简介

OVH SDK for PHP

关键字:

README 文档

README

PHP SDK to consume OVH web services

WARNING : This SDK is currently in development, some functions/methods are not (or not correctly) implemented. Use with care.

Before Using the SDK

Get OVH credentials

You need three keys :

  • Application Key (AK)
  • Applcation Secret (AS)
  • Consumer Key (CK)

You will find in the tools directory a script named getOvhCredentials.php. Use it to get yours credentials (read how to in the header of the script).

Requirements

You need PHP 5.3.2+ compiled with the cURL extension.

Install OVH SDK

Installing via Composer

The recommended way to install OVH SDK is through Composer.

  1. Add toorop/ovh-sdk-php as a dependency in your project's composer.json file:

     {
         "require": {
             "toorop/ovh-sdk-php": "dev-master"
         }
     }
    
  2. Download and install Composer:

     curl -s http://getcomposer.org/installer | php
    
  3. Install your dependencies:

     php composer.phar install
    
  4. Require Composer's autoloader

    Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code's bootstrap process:

     require 'vendor/autoload.php';
    

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.

Using the SDK

Quick Start

<?php
// Include the OVH SDK via composer autoload
require_once 'vendor/autoload.php';
use \Ovh\Common\Ovh;

// Populate your keyring
/** RG : APPLICATION REGION :
 * FR = eu.api.ovh.com
 * CA = ca.api.ovh.com
 * KIMSUFIFR = eu.api.kimsufi.com
 * KIMSUFICA = ca.api.kimsufi.com
 * SYSFR = eu.api.soyoustart.com
 * SYSCA = ca.api.soyoustart.com
 */
$config=array(
    'AK' => 'YOUR APPLICATION KEY',
    'AS' => 'YOUR APPLICATION SECRET',
    'CK' => 'YOUR CONSUMER KEY',
    'RG' => 'YOUR APPLICATION REGION' 
);

// Init your OVH instance
$ovh = new Ovh($config);

/**
 *
 *  Dedicated Server Part
 *
 */

// Get your Dedicated Servers
$dedicatedServerList=$ovh->getDedicatedServerList();
foreach($dedicatedServerList as $dedicatedServerDomain)
    print "$dedicatedServerDomain\n";

// Init a Dedicated Server instance
$dedicatedServer=$ovh->getDedicatedServer($dedicatedServerDomain);

// Get Dedicated Server properties
$r=$dedicatedServer->getProperties();

// Get Dedicated Server Service Infos
$r=$dedicatedServer->getServiceInfos();

// Get current task
$task=$dedicatedServer->getTasks();

// Get properties of a task
$properties = $dedicatedServer->getTaskProperties($taskId);



/**
 *
 *  VPS Part
 *
 */

// Get yours VPS
$vpsList=$ovh->getVpsList();
foreach($vpsList as $vpsDomain)
    print "$vpsDomain\n";

// Init a VPS instance
$vps=$ovh->getVps($vpsDomain);

// Get VPS properties
$r=$vps->getProperties();

// Get VPS Status
$r=$vps->getStatus();

// Get Monitoring
$r=$vps->getMonitoring('today',"cpu:max");

// Get current Monitorin
$r=$vps->getCurrentMonitoring('cpu:max');

// Stop VPS
$vps->stop();

// Start VPS
$vps->start();

// reboot VPS
$vps->reboot();

// (re)Set root password
$vps->setRootPassword();

// Get availables upgrade
$upgrades=$vps->getAvailableUpgrades();

// Get availables options
$options=$vps->getAvailableOptions();

// Get model
$models=$vps->getModels();

// Order a cPanel Licence
$r=$vps->orderCpanelLicense();

// Order a Plesk Licence
$r=$vps->orderPleskLicence(1);

// Order a FTP backup
$r=$vps->orderFtpBackup();

// Get disks
$disks=$vps->getDisks();

// Get disk properties
$properties=$vps->getDiskProperties($diskId);

// Get disk usage
$usage=$vps->getDiskUsage($diskId,'used');

// Get disk monitoring
$monit=$vps->getDiskMonitoring($diskId,'lastday','max');

// Get current task
$task=$vps->getTasks();

// Get properties of a task
$properties = $vps->getTaskProperties($taskId);

// Get VPS IPs
$ip=$vps->getIps();

// Get IP properties
$properties=$vps->getIpProperties($ip);

// Set IP properties
$vps->setIpProperties('$ip', array('reverse'=>'IP Reverse'));

// Get snapshot properties
$properties=$vps->getSnapshotProperties();

// Order a snapshot
$order=$vps->orderSnapshot();

// Get available templates
$templates=$vps->getAvailableTemplates();

// Get templates properties
$properties=$vps->getTemplateProperties($templateId);

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

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 11.92k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 55
  • 点击次数: 17
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 55
  • Watchers: 11
  • Forks: 18
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2013-02-01