alibabacloud/client
Composer 安装命令:
composer require alibabacloud/client
包简介
Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project
README 文档
README
English | 简体中文
Alibaba Cloud Client for PHP
The Alibaba Cloud V1.0 PHP SDK has entered the basic security maintenance phase and is no longer recommended for use. New users should directly use the V2.0 PHP SDK; users who have already integrated the V1.0 PHP SDK are also advised to migrate to the V2.0 PHP SDK. V2.0 PHP SDK is available here: https://github.com/aliyun/alibabacloud-php-sdk, for usage, please refer to Help Center Documentation and Alibaba Cloud OpenAPI Developer Portal.
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.
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 Client for PHP as a dependency:
composer require alibabacloud/client
Some users may not be able to install due to network problems, you can try to switch the Composer mirror.
Please see the Installation for more detailed information about installing the Alibaba Cloud Client for PHP through Composer and other means.
Quick Examples
Before you begin, you need to sign up for an Alibaba Cloud account and retrieve your Credentials.
Create Client
<?php use AlibabaCloud\Client\AlibabaCloud; AlibabaCloud::accessKeyClient('accessKeyId', 'accessKeySecret')->asDefaultClient();
Request
Request styles are divided into
ROAandRPC. Different product styles are different. Please refer to the product documentation before using. It is recommended to use Alibaba cloud SDK for PHP, the details have been encapsulated, and you do not need to care about the style.
ROA Request
<?php use AlibabaCloud\Client\AlibabaCloud; use AlibabaCloud\Client\Exception\ClientException; use AlibabaCloud\Client\Exception\ServerException; try { $result = AlibabaCloud::roa() ->regionId('cn-hangzhou') // Specify the requested regionId, if not specified, use the client regionId, then default regionId ->product('CS') // Specify product ->version('2015-12-15') // Specify product version ->action('DescribeClusterServices') // Specify product interface ->serviceCode('cs') // Set ServiceCode for addressing, optional ->endpointType('openAPI') // Set type, optional ->method('GET') // Set request method ->host('cs.aliyun.com') // Location Service will not be enabled if the host is specified. For example, service with a Certification type-Bearer Token should be specified ->pathPattern('/clusters/[ClusterId]/services') // Specify path rule with ROA-style ->withClusterId('123456') // Assign values to parameters in the path. Method: with + Parameter ->request(); // Make a request and return to result object. The request is to be placed at the end of the setting print_r($result->toArray()); } catch (ClientException $exception) { print_r($exception->getErrorMessage()); } catch (ServerException $exception) { print_r($exception->getErrorMessage()); }
RPC Request
<?php use AlibabaCloud\Client\AlibabaCloud; use AlibabaCloud\Client\Exception\ClientException; use AlibabaCloud\Client\Exception\ServerException; try { $result = AlibabaCloud::rpc() ->product('Cdn') ->version('2014-11-11') ->action('DescribeCdnService') ->method('POST') ->request(); print_r($result->toArray()); } catch (ClientException $exception) { print_r($exception->getErrorMessage()); } catch (ServerException $exception) { print_r($exception->getErrorMessage()); }
Documentation
- Prerequisites
- Installation
- Client & Credentials
- Request
- Result
- Region
- Host
- SSL Verify
- Debug
- Log
- Test
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
- Alibaba Cloud Regions & Endpoints
- Alibaba Cloud OpenAPI Developer Portal
- Packagist
- Composer
- Guzzle Documentation
- Latest Release
License
Copyright (c) 2009-present, Alibaba Cloud All rights reserved.
alibabacloud/client 适用场景与选型建议
alibabacloud/client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.71M 次下载、GitHub Stars 达 221, 最近一次更新时间为 2018 年 11 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「client」 「library」 「sdk」 「cloud」 「tool」 「aliyun」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alibabacloud/client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alibabacloud/client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alibabacloud/client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Inbox pattern process implementation for your Laravel Applications
Mock PSR-18 HTTP client
Asynchronous MQTT client built on React
Core library that defines common interfaces used by the rest of the intahwebz..
Amqp classes
Provides command to manage a web library directory
统计信息
- 总下载量: 3.71M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 239
- 点击次数: 25
- 依赖项目数: 391
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2018-11-28