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.
-
Add
toorop/ovh-sdk-phpas a dependency in your project'scomposer.jsonfile:{ "require": { "toorop/ovh-sdk-php": "dev-master" } } -
Download and install Composer:
curl -s http://getcomposer.org/installer | php -
Install your dependencies:
php composer.phar install -
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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 toorop/ovh-sdk-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
OVH SDK integration
Library to use OVH PCI Object Storage API with Laravel 4.2.
Librairie pour interagir avec un object storage. Utilise l'api swift avec authentification v2 pour fonctionner avec OVH
The OVH Sms Api integration for Laravel 5.
OVH SMS API integration for Laravel 7+.
An OVH API integration for Symfony2
统计信息
- 总下载量: 11.92k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 55
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2013-02-01