PHP code example of szwtdl / simple-icloud
1. Go to this page and download the library: Download szwtdl/simple-icloud 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/ */
szwtdl / simple-icloud example snippets
$app = new SimpleIcloud\Application([
'base_uri' => 'http://localhost:8080',
'timeout' => '5.0'
]);
// 登录接口
$result = $app->login([
'username' => '[email protected] ',
'password' => '12345678',
'verifyType' => 'sms', // 短信登录
'deviceid' => 'device_id' // 设备ID
]);
//安装包
composer hp artisan vendor:publish --provider="SimpleIcloud\ServiceProvider"
// 配置文件
config/icolud.php
// 执行登录
$result = app('icloud')->login([
'username' => '[email protected] ',
'password' => '123456',
]);
namespace SimpleIcloud\Requests;
use SimpleIcloud\AbstractRequest;
class WhatsappRequest extends AbstractRequest
{
protected string $path = 'v2/api/auth/reset'; //请求路径
protected array $params = []; //请求参数
protected $client; //这里是具体请求类
public function __construct($client, $params = [])
{
$this->client = $client;
$this->params = $params;
}
public function getData(): array
{
//这里可以处理数据
return parent::getData();
}
}
bash
composer config repositories.simple-icloud path ../simple-icloud // 引入本地仓库
composer \ServiceProvider"
php artisan vendor:publish --tag=icloud
// 如果不知道可以 php artisan vendor:publish 可以列出当前的可用户的包