Download the PHP package jdcloud-api/jdcloud-sdk-php without Composer

On this page you can find all versions of the php package jdcloud-api/jdcloud-sdk-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package jdcloud-sdk-php

简介

欢迎使用京东云开发者Php工具套件(Php SDK)。使用京东云Php SDK,您无需复杂编程就可以访问京东云提供的各种服务。

为了方便您理解SDK中的一些概念和参数的含义,使用SDK前建议您先查看京东云OpenAPI使用入门。要了解每个API的具体参数和含义,请参考程序注释或参考OpenAPI&SDK下具体产品线的API文档。

环境准备

1.京东云Php SDK适用于Php 5.5及以上。

2.在开始调用京东云open API之前,需提前在京东云用户中心账户管理下的AccessKey管理页面申请accesskey和secretKey密钥对(简称AK/SK)。AK/SK信息请妥善保管,如果遗失可能会造成非法用户使用此信息操作您在云上的资源,给你造成数据和财产损失。

SDK使用方法

建议使用Composer安装京东云Php SDK:

首先在composer.json添加

"require" : {
    "php" : ">=5.5",
    "jdcloud-api/jdcloud-sdk-php" : ">=4.0.0"
}

然后使用Composer安装

php composer.phar install

composer install 

您还可以下载sdk源代码自行使用。

SDK使用中的任何问题,欢迎您SDK使用问题反馈页面交流。

注意:京东云并没有提供其他下载方式,请务必使用上述官方下载方式!

调用示例

以下是创建单个云主机实例详情的调用示例

use Jdcloud\Credentials\Credentials;
use Jdcloud\Result;
use Jdcloud\Vm\VmClient;
public function testCreateInstances()
{
    $vm = new VmClient([
        'credentials'  => new Credentials('ak', 'sk'),
        'version' => 'latest',
        'scheme' => 'https'
    ]);

    try{
        $res = $vm->createInstances([
            'regionId'  => 'cn-north-1',
            'instanceSpec' => [
                'az' => 'cn-north-1a',
                'imageId' => '8e187a0a-ea7c-4ad1-ba32-f21e52fb8926',
                'instanceType' =>  'g.n2.medium',
                'name' => 'phpcreate',
                'primaryNetworkInterface' => [
                    'networkInterface' => [
                        'subnetId' => 'subnet-ll47yy373i'
                     ]
                ],
                'systemDisk' => [
                    'diskCategory' => 'local'
                ]
            ]
        ]);
        print_r($res);
        print("Request Id: ". $res['requestId']. "\n");
        print_r($res['result']);
    }catch (\Jdcloud\Exception\JdcloudException $e) {
        print("Detail Message: " . $e->getMessage(). "\n");
        print("Request Id: ". $e->getJdcloudRequestId(). "\n");
        print("Error Type: ". $e->getJdcloudErrorType(). "\n");
        print("Error Code: " . $e->getJdcloudErrorCode(). "\n");
        print("Error Detail Status: ". $e->getJdcloudErrorStatus(). "\n");
        print("Error Detail Message: ". $e->getJdcloudErrorMessage(). "\n");
    }
}

如果需要设置额外的header,例如要调用开启了MFA操作保护的接口,需要传递x-jdcloud-security-token,则按照如下方式:

    $res = $vm->deleteInstances([
        'regionId'  => 'cn-north-1',
        'instanceId'  => 'xxx',
        'extraHeaders' => [
            'x-jdcloud-security-token' => 'xxxx'
        ]
    ]);

如果需要设置访问点,配置超时等,请参考如下更复杂的例子:

更多调用示例参考 SDK使用Demo


All versions of jdcloud-sdk-php with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
guzzlehttp/guzzle Version ^5.3.1|^6.2.1
guzzlehttp/psr7 Version ^1.4.1
guzzlehttp/promises Version ~1.0
mtdowling/jmespath.php Version ~2.2
ext-pcre Version *
ext-json Version *
ext-simplexml Version *
ext-spl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jdcloud-api/jdcloud-sdk-php contains the following files

Loading the files please wait ....