digfish/php-meocloud-cli
最新稳定版本:0.1
Composer 安装命令:
composer require digfish/php-meocloud-cli
包简介
Meocloud PHP API Implementation
README 文档
README
php-meocloud-cli
PHP API Client implementation for the Meocloud Storage System.
Install
The package is hosted on packagist. To install run:
composer require --dev digfish/php-meocloud-cli
Get credentials
To use this application, you must be a Meo Client, register at MeoCloud with your MeoID, and there register for a new application. Get your Consumer key and Secret and Choose "Out of Band" has the way to authorize the tokens. Uncheck "sandbox" in order to have total access, then a create a file .env in the main directory with this content:
CONSUMER_KEY=<YOUR CONSUMER KEY HERE>
CONSUMER_SECRET=<YOUR SECRET HERE>
Using this file execute the script grab_credentials.php in the main directory, you will prompted to visit an url in your browser, click "AUTORIZAR" and you will be provided with a PIN that you should input at the script. If everything goes well, the .env file will be rewritten with the new oauth token and oauth secret. With this data provided, you are ready to use the project.
Code example
use \digfish\meocloudclient\MeocloudClient; $meo = new MeocloudClient(); // grab the root directory list $dirlist = $meo->get_metadata(); // send a file to meocloud $meo->send_file('README.md'); // get a file from meocloud $meo->get_file('README.md'); // create directory $meo->create_folder('ola'); // delete file $meo->delete_file('README.md');
Unit tests
You have a file with unitary tests: MeocloudClientTest.php. Just run phpunit MeocloudClientTest.php.
Environment variables
The variables CONSUMER_KEY,CONSUMER_SECRET,OAUTH_TOKEN and OAUTH_TOKEN_SECRET should hold the value of your API key. You can set this via a .env file or your own code using putenv or for example $_ENV['OAUTH_TOKEN_SECRET'].
What is implemented
| Method | API |
|---|---|
| get_metadata() | GET Metadata/meocloud/ |
| get_file() | GET Files/meocloud/:name |
| send_file() | PUT Files/meocloud/:name |
| delete_file() | POST Fileops/Delete |
| create_folder() | POST Fileops/CreateFolder |
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2022-07-09