PHP code example of nookery / laravel-huawei-cloud-client

1. Go to this page and download the library: Download nookery/laravel-huawei-cloud-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nookery / laravel-huawei-cloud-client example snippets


    \HuaweiCloud\Facades\HuaweiCloud::customers();

    /**
     * 创建用户
     *
     * @param string $accountId 伙伴销售平台的用户唯一标识,该标识的具体值由伙伴分配
     * @param string $userName 客户的华为云账号名
     * @param string $cooperationType 模式,1是推荐模式,0是垫付模式,默认是垫付模式
     * @return mixed
     * @throws GuzzleException
     * @throws HuaweiCloudException
     */
    \HuaweiCloud\Facades\HuaweiCloud::createCustomer($accountId = '', $userName = '', $cooperationType = '0');

    /**
     * 给用户设置折扣
     *
     * @param string $customerId 客户ID
     * @param int $discount 折扣
     * @param \Carbon\Carbon $expiresAt 失效时间,默认2年后,或传递一个Canbon实例
     * @return mixed
     * @throws GuzzleException
     * @throws HuaweiCloudException
     */
    \HuaweiCloud\Facades\HuaweiCloud::setDiscount($customerId = '', $discount = 1, \Carbon\Carbon $expiresAt = null);

composer ravel版本 < 5.5(5.5以下版本不支持扩展包发现),需在config/app.php文件中providers中增加:
\HuaweiCloud\Provider::class,

php artisan config:clear
php artisan vendor:publish --provider="HuaweiCloud\Provider"