Alibaba Cloud SDK for PHP

Overview

English | 简体中文

Alibaba Cloud SDK for PHP

Latest Stable Version composer.lock Total Downloads License codecov Travis Build Status Appveyor Build Status

AlibabaCloud

Alibaba Cloud SDK for PHP is a development kit that supports quick access to products, dependency on Alibaba Cloud Client for PHP.

Release Notes

We developed a new kernel on the principle of eliminating known issues and compatible with old grammar, adding the following features:

Prerequisites

Your system will need to meet the Prerequisites, including having PHP >= 5.5. We highly recommend having it compiled with the cURL extension and cURL 7.16.2+.

Installation

If Composer is already installed globally on your system, run the following in the base directory of your project to install Alibaba Cloud SDK for PHP as a dependency:

composer require alibabacloud/sdk

Please see the Installation for more detailed information about installing through Composer and other ways.

Troubleshoot

Troubleshoot Provide OpenAPI diagnosis service to help developers locate quickly and provide solutions for developers through RequestID or error message.

Online Demo

Alibaba Cloud OpenAPI Developer Portal provides the ability to call the cloud product OpenAPI online, and dynamically generate SDK Example code and quick retrieval interface, which can significantly reduce the difficulty of using the cloud API.

Quick Examples

Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your Credentials. Before request, please Understanding the Clients, after request, please Understanding the Result.

Currently, only some Alibaba Cloud products are supported, Supported Products, For products that are not supported, you can use Alibaba Cloud Client for PHP to initiate custom requests, and you can use Alibaba Cloud OpenAPI Developer Portal to generate Alibaba Cloud Client for PHP code online.

<?php

use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;
use AlibabaCloud\Ecs\Ecs;

// Set up a global client
AlibabaCloud::accessKeyClient('foo', 'bar')
            ->regionId('cn-hangzhou')
            ->asDefaultClient();

try {
    // Access product APIs
    $request = Ecs::v20140526()->describeRegions();
    
    // Set options/parameters and execute request
    $result = $request->withResourceType('type') // API parameter
                      ->withInstanceChargeType('type') // API parameter
                      ->client('client1') // Specify the client for send
                      ->debug(true) // Enable the debug will output detailed information
                      ->connectTimeout(0.01) // Throw an exception when Connection timeout 
                      ->timeout(0.01) // Throw an exception when timeout 
                      ->request(); // Execution request

    // Can also Set by passing in an array
    $options = [
                   'debug'           => true,
                   'connect_timeout' => 0.01,
                   'timeout'         => 0.01,
                   'query'           => [
                       'ResourceType' => 'type',
                       'InstanceChargeType' => 'type',
                   ],
               ];
    
    // Settings priority
    $result2 = Ecs::v20140526()
                  ->describeRegions($options)
                  ->options([
                                'query' => [
                                    'Key'      => 'I will overwrite this value in constructor',
                                    'new'      => 'I am new value',
                                ],
                            ])
                  ->options([
                                'query' => [
                                    'Key' => 'I will overwrite the previous value',
                                    'bar' => 'I am new value',
                                ],
                            ])
                  ->debug(false) // Overwrite the true of the former
                  ->request();
    
} catch (ClientException $exception) {
    echo $exception->getMessage(). PHP_EOL;
} catch (ServerException $exception) {
    echo $exception->getMessage() . PHP_EOL;
    echo $exception->getErrorCode(). PHP_EOL;
    echo $exception->getRequestId(). PHP_EOL;
    echo $exception->getErrorMessage(). PHP_EOL;
}

Issues

Opening an Issue, Issues not conforming to the guidelines may be closed immediately.

Changelog

Detailed changes for each release are documented in the release notes.

Contribution

Please make sure to read the Contributing Guide before making a pull request.

References

License

Apache-2.0

Copyright (c) 2009-present, Alibaba Cloud All rights reserved.

Issues
  • 现在这个sdk能用吗?

    现在这个sdk能用吗?

    现在这个sdk能用吗?有没有使用文档?

    opened by tangtanglove 36
  • 容器镜像服务Cr  配置问题

    容器镜像服务Cr 配置问题

    • PHP 版本:7.2.6
    • 平台:docker alpine
    • 产品名称:容器镜像服务Cr
    • 产品版本:20160607
    • API:getRepoList

    代码基本是拿官网文档过来后做的修改:

    AlibabaCloud::accessKeyClient('xxx','xxx')->regionId('cn-hangzhou')->asDefaultClient();
    
    try {
    	$options = [
    	    'debug' => true,
    	    'query' => [
    	        'Status' => 'NORMAL',
    	        'RepoNamePrefix' => ''
    	    ]
    	];
    	$request = Cr::v20160607()
    	            ->getRepoList($options);
    
    	$r = $request->request();
    } catch (ServerException $e) {
        echo $e->getResult();
    }
    

    最后捕获打出来的结果是:

    {"RequestId":"806D70E8-32B0-4F18-8C8A-CA54E5D22E2E","HostId":"location.aliyuncs.com","Code":"Illegal Parameter","Message":"Please check the parameters"}
    

    不清楚是哪里参数有误。 而且API文档https://help.aliyun.com/document_detail/72399.html 上还有个RepoNamePrefix参数,要求是必须提供该参数,但SDK中又没有AlibabaCloud\Cr\V20160607\GetRepoList::withRepoNamePrefix()这样的函数,所以我通过options['query']进行了传递,不知道是否正确。

    accessKeyId和accessKeySecret都是正确的 到底哪里出现了参数错误?

    为了偷懒,我copy了别人提交的一样反馈记录.

    opened by yizhihouzi 17
  • Image search empty codes

    Image search empty codes

    I am currently testing Image search from this repo, but unfortunately, I am sending an empty request as per stated by the Support Engineer when doing tickets in the console. I am writing here as it was suggested by the Support engineer to raise an issue here instead.

    My question is that, why is the Image search codes are empty compare to the Aliyun open api sdk or the downloadable library

    Any way you can update the image search? As I really prefer to use composer when installing libraries.

    If you have a question about Alibaba Cloud that is not a bug report or feature request, please post it in https://selfservice.console.aliyun.com/ticket/createIndex

    Questions posted to this repository will be closed.

    opened by rfpdl 16
  • mnsClient BatchReceiveMessage 参数bug

    mnsClient BatchReceiveMessage 参数bug

    • PHP Version:7.2
    • Platform:mac
    • Product:mns
    • Product Version:1.2.4
    • API: BatchReceiveMessage

    hi
    sdk中提供的mnsClient存在参数问题 导致无法正常获取mns队列消息

    我方在升级使用新版php-sdk, 出现无法拉取mns消息bug 阿里云官方工单反馈如下 工程师 60810 号 : 您好,已经为您核实,您的这个sdk不是消息服务mns官方提供的sdk,传的参数WaitSeconds 这个是非标准的,标准的应该是:waitseconds,还要请您知晓哈,官方提供的mns的sdk,您可以参考下 https://help.aliyun.com/document_detail/32381.html?spm=a2c4g.11186623.6.655.2b947f87MOpJpF 您使用这个sdk测试下,看是否还有500的情况呢?

    经查证问题出自 AlibabaCloud\Dybaseapi\MNS\Requests\BatchReceiveMessage; line:86 88 两个参数错误

    请核实.

    opened by chinayin 12
  • CAS服务API版本与文档比较缺失

    CAS服务API版本与文档比较缺失

    https://github.com/aliyun/openapi-sdk-php/tree/master/src/Cas 目前SDK有且只有 V20180813

    而文档是 V20180713 + V20180813

    opened by xiaohuilam 10
  • 阿里云一键取号API报 Specified parameter Version is not valid

    阿里云一键取号API报 Specified parameter Version is not valid

    我这边因为项目是php5.6,不能用composer方式引入项目,所以只能去研究阿里云一键取号Api的接口参数去请求, 结果其他请求参数都没有问题,参数Version就报错,https://api.aliyun.com/new?spm=a2c4g.11186623.2.13.2fc27861OpQnPn#/?product=Dypnsapi&version=2017-05-25&api=GetMobile&params={%22RegionId%22:%22cn-hangzhou%22}&tab=DEMO&lang=PHP 这个url里面的version是填 2017-05-25,我也是填这个,结果就报错了。 想问下version参数应该怎么填 image

    opened by 111Quentin 8
  • CCS的配置有错?或者CCS的SDK还不完整?

    CCS的配置有错?或者CCS的SDK还不完整?

    你好,我在CCS的配置文件里面发现是这样配置的: 'ccs' => [ 'cn-hangzhou' => 'ccs.aliyuncs.com', ], 但是我在官方文档中看到的URL是这样的:https://cschat-ccs.aliyun.com/openapi/forwardMessage?tntInstId=XXX&scene=YYY&src=outerservice&timestamp=1487230487910&digest=ZZZ

    域名为什么不对?

    另外,官方文档中的forwardMessage、tntInstId在整个SDK中都找不到。

    是不是CCS的SDK还不完整?或者是不是我哪里错了?

    opened by softwarezhu 6
  • 内容安全 自定义文本库使用方式?

    内容安全 自定义文本库使用方式?

    • PHP Version: PHP 7.3.21-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Aug 7 2020 14:44:10) ( NTS )
    • Platform: Linux d0aa2e73b694 4.19.76-linuxkit #1 SMP Tue May 26 11:42:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
    • Product: Green
    • Product Version: 20180509
    • API: getSimilarityLibrary addSimilarityLibrary

    您好,我想问下,内容安全 SDK ,创建自定义文本库。是否是 getSimilarityLibrary() 方法。我通过此方法返回状态码 200 , 但是云盾控制台似乎没有?还是说,通过接口创建的文本库在控制台看不到?

    另外,我通过 getSimilarityLibrary 获取报错。

    $body = [
                'ServiceModule' => 'open_api'
            ];
    $body = json_encode($body);
    return \AlibabaCloud\Green\Green::v20180509()->getSimilarityLibrary()->body($body)->request()->toArray();
    

    image

    opened by hedeqiang 6
  • Support release tool

    Support release tool

    • Support release tool.
    • Improve test.
    You need to complete
    • [x] unit tests and/or feature tests
    • [x] documentation is changed or added
    opened by ghost 5
  • STS获取accessToken出师不利

    STS获取accessToken出师不利

    提示:May not yet support product Sts quick access, you can use [Alibaba Cloud Client for PHP] to send any custom requests: https://github.com/aliyun/openapi-sdk-php-client/blob/master/docs/en-US/3-Request.md

    大佬们求救,第一次用阿里云的这种SDK方式。有点懵。如下图所示,提示错误如上图。

    我现在是想WEB上传文件到OSS,目前看文档说是要通过AK的方式来获取令牌环,然后用令牌环来上传文件,就是这个accessToken,卡这一步了。不知道逻辑上对不对,求救。

    opened by huangdengpan 5
  • 真他Y 的傻叉,一堆版本的 SDK。

    真他Y 的傻叉,一堆版本的 SDK。

    第一次用阿里云的 API。 调用个业务第一步:先研究了半天的文档,知道了 openapi 的 demo 里面有源码可以用,找到了,下载对应的 demo,然后看着 demo 里面的垃圾代码,引入“各种版本的”的包,谨慎的抄着命名空间,然后好不容易接完了 V201903xx 的版本 API哈哈哈,这他妈有意思的 API ,想接个人机验证的,去官网文档找半天找到个 afs 业务的 sdk,源码下回来直接吐了,引入的几个类都是废弃的,再想找找是不是还有其他的文档,实在折腾。要不是业务需要,再也不想接 aliyun 了。

    opened by Linij 1
  • 咋的,SDK 都是外包做的吗?

    咋的,SDK 都是外包做的吗?

    你们 PHP 是不是上个世纪开发的 SDK 了。什么玩意啊,自己 review 过吗,给用户接入体验极差。

    opened by Linij 0
  • 希望能够兼容php8

    希望能够兼容php8

    您的功能请求是否与问题有关? 请描述一下。 升级到php8后,安装sdk包失败。 Problem 1 - ralouphie/mimey 2.1.0 requires php ^5.4|^7.0 -> your php version (8.0.11) does not satisfy that requirement. - alibabacloud/alimt-20181012 1.0.1 requires alibabacloud/tea-oss-utils ^0.2.0 -> satisfiable by alibabacloud/tea-oss-utils[0.2.2]. - alibabacloud/tea-oss-utils 0.2.2 requires ralouphie/mimey ^2.1 -> satisfiable by ralouphie/mimey[2.1.0]. - alibabacloud/alimt-20181012 is locked to version 1.0.1 and an update of this package was not requested. 描述你想要的解决方案 发现有个依赖包目前不支持php8

    描述您考虑过的替代方案 希望能够兼容php8

    opened by lizcao 0
  • 新版sdk示例如何让返回信息显示中文

    新版sdk示例如何让返回信息显示中文

    请问新版sdk示例如何让返回信息显示中文 以及为什么在程序里使用sdk调用接口的时候不返回json或者xml数据而是直接抛异常

    opened by gasion 0
  • DTS API does not follow the shared region setting defined in DefaultClient

    DTS API does not follow the shared region setting defined in DefaultClient

    • PHP 版本: 7.4 (via Homebrew)
    • 平台:MacOS
    • 产品名称:Dts
    • 产品版本:1.8.1074
    • APIDts::v20200101()->describeDtsJobs

    Received error as following:

    ↘ Caused by [AlibabaCloud\Client\Exception\ServerException#400] MissingRegion: Region is mandatory for this action. RequestId: B830AAD3-3191-5EF2-A6B3-C44931386BF2 POST "http://dts.aliyuncs.com" 400
    

    Pure Code:

    AlibabaCloud::accessKeyClient($getAccessKeyId, $getAccessKeySecret)
                    ->regionId($regionId)
                    ->asDefaultClient();
    // error in next request call!
    $response = Dts::v20200101()->describeDtsJobs([])
                    ->withJobType('SYNC')
                    ->withPageNumber(1)
                    ->withPageSize(30)
                    ->request();
    
    opened by sinri 0
  • Status code must be an integer value between 1xx and 5xx.

    Status code must be an integer value between 1xx and 5xx.

    • PHP 版本:7.4

    • 平台:无

    • 产品名称:mns

    • 产品版本:无

    • API:http://123456.mns.cn-hangzhou.aliyuncs.com/ (为安全,数据换成了123456)

    • 问题 Uncaught InvalidArgumentException: Status code must be an integer value between 1xx and 5xx.

    • 调用行数: vendor/alibabacloud/dybaseapi/MNS/HttpHelper.php(64)

    opened by storyflow 0
  • 物联网北京企业实例无法连接

    物联网北京企业实例无法连接

    • PHP 版本:7.4
    • 平台:Linux
    • 产品名称:IOT
    • 产品版本:v20180120
    • API:All

    因为北京区域的endpoint写死为 "cn-beijing": "iot.aliyuncs.com", 如果改成 "iot.cn-beijing.aliyuncs.com"就可以正常使用

    opened by everalan 0
  • composer2提示以下警告 版本1.8.895以上

    composer2提示以下警告 版本1.8.895以上

    • PHP Version: 7.2
    • Platform: mac
    • Product: sdk
    • Product Version: 1.8.895
    • API:

    composer2提示以下警告 版本1.8.895以上,大小写问题吧.修复下吧

    Class AlibabaCloud\imm\imm located in ./vendor/alibabacloud/sdk/src/Imm/Imm.php does not comply with psr-4 autoloading standard. Skipping. Class AlibabaCloud\ocr\ocr located in ./vendor/alibabacloud/sdk/src/Ocr/Ocr.php does not comply with psr-4 autoloading standard. Skipping. Class AlibabaCloud\facebody\facebody located in ./vendor/alibabacloud/sdk/src/Facebody/Facebody.php does not comply with psr-4 autoloading standard. Skipping. Class AlibabaCloud\imageprocess\imageprocess located in ./vendor/alibabacloud/sdk/src/Imageprocess/Imageprocess.php does not comply with psr-4 autoloading standard. Skipping. Class AlibabaCloud\dcdn\dcdn located in ./vendor/alibabacloud/sdk/src/Dcdn/Dcdn.php does not comply with psr-4 autoloading standard. Skipping. Class AlibabaCloud\sgw\sgw located in ./vendor/alibabacloud/sdk/src/Sgw/Sgw.php does not comply with psr-4 autoloading standard. Skipping. Class AlibabaCloud\codeup\codeup located in ./vendor/alibabacloud/sdk/src/Codeup/Codeup.php does not comply with psr-4 autoloading standard. Skipping.

    opened by chinayin 0
  • 1.8.892 版本Laravel上安装报错

    1.8.892 版本Laravel上安装报错

    报错内容:

        The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)
        Unzip with unzip command failed, falling back to ZipArchive class
        Install of alibabacloud/sdk failed
     1/1 [============================] 100%
    
      [RuntimeException]
      The archive may contain identical file names with different capitalization (which fails on case insensitive filesystem
      s): ZipArchive::extractTo(): File exists
    
    
    
      [ErrorException]
      ZipArchive::extractTo(): File exists
    
    opened by aoeng 2
Releases(1.8.1228)
Shopware PHP SDK is a simple SDK implementation of Shopware 6 APIs

Shopware PHP SDK is a simple SDK implementation of Shopware 6 APIs. It helps to access the API in an object-oriented way.

Thuong Le 40 Dec 22, 2021
Zoho CRM API SDK is a wrapper to Zoho CRM APIs. By using this sdk, user can build the application with ease

Archival Notice: This SDK is archived. You can continue to use it, but no new features or support requests will be accepted. For the new version, refe

null 79 Dec 30, 2021
Appwrite configuration for Cloud Function runtimes settings 🌩

Appwrite Runtimes Appwrite repository for Cloud Function runtimes that contains the configurations and tests for all of the Appwrite runtime environme

Appwrite 20 Jan 11, 2022
The 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your infrastructure and leverage the power of 1Password Secrets Automation

1Password Connect PHP SDK The 1Password Connect PHP SDK provides your PHP applications access to the 1Password Connect API hosted on your infrastructu

Michelangelo van Dam 8 Sep 16, 2021
Unofficial Firebase Admin SDK for PHP

Firebase Admin PHP SDK Table of Contents Overview Installation Documentation Support License Overview Firebase provides the tools and infrastructure y

kreait 1.7k Jan 20, 2022
Notion PHP SDK

Notion PHP SDK This is an unofficial PHP SDK for the new public Notion API. It's work in progress as we didn't get the change to be included to the pr

Codecycler 22 Jan 4, 2022
爱发电非官方简易 PHP SDK

afdian-php-sdk 爱发电非官方简易 PHP SDK by Akkariin 这是一个简单的 SDK,可以用于查询爱发电的订单和赞助者信息 Installation 将项目 clone 到本地即可 git clone https://github.com/ZeroDream-CN/afdi

ZeroDream-CN 10 Jan 12, 2022
AWS Cognito package using the AWS SDK for PHP/Laravel

Laravel Package to manage Web and API authentication with AWS Cognito AWS Cognito package using the AWS SDK for PHP This package provides a simple way

EllaiSys 33 Jan 20, 2022
PHP SDK to interact with the Casper Network nodes via RPC

casper-php-sdk PHP SDK to interact with Casper Network nodes via RPC Install composer require make-software/casper-php-sdk Examples RPC Client: $node

MAKE Technology LLC 6 Dec 21, 2021
A Laravel 5+ (and 4) service provider for the AWS SDK for PHP

AWS Service Provider for Laravel 5/6/7/8 This is a simple Laravel service provider for making it easy to include the official AWS SDK for PHP in your

Amazon Web Services 1.4k Jan 14, 2022
A complete Notion SDK for PHP developers.

notion-sdk-php A complete Notion SDK for PHP developers. Installation composer require mariosimao/notion-php Getting started A Notion token will be n

Mario Simão 39 Jan 11, 2022
SDK of the LINE Login API for PHP

LINE Login for PHP SDK of the LINE Login API for PHP Documentation See the official API documentation for more information. Installation Use the packa

null 2 Nov 3, 2021
PHP SDK - Flexie CRM fiskalizimi solution

PHP SDK - Flexie CRM fiskalizimi solution Fiskalizimi PHP SDK allows you to talk and generate your e-invoices programmatically from your own solution

Flexie CRM 3 Dec 30, 2021
PHP Digital Green Certificate SDK

Digital Green Certificate SDK PHP Indice Contesto Installazione Uso Licenza Dettaglio licenza Contesto Attenzione, questo repository è derivato dalle

null 9 Jan 11, 2022
Esse SDK em PHP foi desenvolvido no intuito de tornar mais prático a integração com nossa API.

Sobre Beedoo SDK Acessar documentação completa da Beedoo API. A API é organizada seguindo a arquitetura REST, boas práticas, convenções e padrões como

Beedoo Edtech 5 Dec 2, 2021
A PHP SDK for accessing the OpenAI GPT-3 API

OpenAI GPT-3 Api Client in PHP Installation You can install the package via composer: composer require orhanerday/open-ai Usage use Orhanerday\OpenAi\

Orhan erday 127 Jan 12, 2022
The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login

Facebook SDK for PHP (v5) This repository contains the open source PHP SDK that allows you to access the Facebook Platform from your PHP app. Installa

Meta Archive 3.1k Jan 10, 2022
PHP SDK for the Sellix Developers API (developers.sellix.io)

PHP SDK for the Sellix Developers API (developers.sellix.io). Quickly get started and create products, payments and more using PHP.

Sellix 2 Jan 8, 2022
Aliyun OSS SDK for PHP

Alibaba Cloud OSS SDK for PHP README of Chinese Overview Alibaba Cloud Object Storage Service (OSS) is a cloud storage service provided by Alibaba Clo

Alibaba Cloud 908 Jan 12, 2022