定制 denchotsanov/pcloud-php-sdk 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

denchotsanov/pcloud-php-sdk

Composer 安装命令:

composer require denchotsanov/pcloud-php-sdk

包简介

pCloud SDK for PHP

README 文档

README

A PHP library to access pCloud API

Table of Contents

System requirements

Get started

Register your application

In order to use this SDK, you have to register your application in My applications.

Install the SDK

Using Composer

Install Composer.

$ composer require denchotsanov/pcloud-php-sdk

or add the following to composer.json file

"require": {
  "denchotsanov/pcloud-php-sdk": "2.*"
}

Manually

Copy lib/ folder and include lib/pCloud/autoload.php in your code

Initializing the SDK

The SDK uses an OAuth 2.0 access token to authorize requests to the pCloud API. You can obtain a token using the SDK's authorization flow. To allow the SDK to do that, find App Key, App secret and Redirect URIs in your application configuration page and add them to /example/code.php and /example/auth.php.

Note that redirect_uri is optional.

Run /example/code.php to get an authorization code and use this code in /example/auth.php. This will return access_token and locationid.

Example

// Include autoload.php and set the credential file path

$access_token = "ACCESS_TOKEN";
$locationid = 1;

$pCloudApp = new pCloud\App();
$pCloudApp->setAccessToken($access_token);
$pCloudApp->setLocationId($locationid);

// Create Folder instance

$pcloudFolder = new pCloud\Folder($pCloudApp);

// Create new folder in root

$folderId = $pcloudFolder->create("New folder");

// Create File instance

$pcloudFile = new pCloud\File($pCloudApp);

// Upload new file in created folder

$fileMetadata = $pcloudFile->upload("./sample.png", $folderId);

// Get folder content

$folderContent = $pcloudFolder->getContent($folderId);

Creating custom requests

$access_token = "";
$locationid = 1;

$pCloudApp = new pCloud\App();
$pCloudApp->setAccessToken($access_token);
$pCloudApp->setLocationId($locationid);

$method = "userinfo";
$params = array();

$request = new pCloud\Request($pCloudApp);
$response = $request->get($method, $params); // the second argument is optional

统计信息

  • 总下载量: 354
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 25
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固