alibabacloud / client
Alibaba Cloud Client for PHP - Use Alibaba Cloud in your PHP project
Installs: 2 725 809
Dependents: 311
Suggesters: 0
Security: 0
Stars: 221
Watchers: 7
Forks: 54
Open Issues: 7
Requires
- php: >=5.5
- ext-curl: *
- ext-json: *
- ext-libxml: *
- ext-mbstring: *
- ext-openssl: *
- ext-simplexml: *
- ext-xmlwriter: *
- adbario/php-dot-notation: ^2.4.1
- clagiordano/weblibs-configmanager: ^1.0
- guzzlehttp/guzzle: ^6.3|^7.0
- mtdowling/jmespath.php: ^2.5
Requires (Dev)
- ext-dom: *
- ext-pcre: *
- ext-sockets: *
- ext-spl: *
- composer/composer: ^1.8
- drupal/coder: ^8.3
- league/climate: ^3.2.4
- mikey179/vfsstream: ^1.6
- monolog/monolog: ^1.24
- phpunit/phpunit: ^5.7|^6.6|^7.5|^8.5|^9.5
- psr/cache: ^1.0
- symfony/dotenv: ^3.4
- symfony/var-dumper: ^3.4
Suggests
- ext-sockets: To use client-side monitoring
- dev-master
- 1.5.32
- 1.5.31
- 1.5.30
- 1.5.29
- 1.5.28
- 1.5.27
- 1.5.25
- 1.5.24
- 1.5.23
- 1.5.22
- 1.5.21
- 1.5.20
- 1.5.19
- 1.5.18
- 1.5.17
- 1.5.16
- 1.5.15
- 1.5.14
- 1.5.13
- 1.5.12
- 1.5.11
- 1.5.10
- 1.5.9
- 1.5.8
- 1.5.7
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-ram-role-provder
- dev-ci
This package is auto-updated.
Last update: 2024-12-17 03:58:36 UTC
README
English | 简体中文
Alibaba Cloud Client for PHP
Alibaba Cloud Client for PHP is a client tool that helps PHP developers manage credentials and send requests, Alibaba Cloud SDK for PHP dependency on this tool.
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
ROA
andRPC
. 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.