Skip to content

This library is built to use Yandex Disk API with PHP in object oriented way.

Notifications You must be signed in to change notification settings

FlySquare/yandex-disk-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yandex Disk Api Client

This library is built to deal with Yandex Disk API.

Installation

composer require siyahmadde/yandex-disk-api

Usage

First you need to create an alias

use Siyahmadde\Disk;
  • Get an Id from Yandex then use that id to create an object from the class
$disk = new Disk('Your Id');
  • Now you need to obtain a token from Yandex. To get the url where you can obtain the token call getLoginToken method.
$disk->getLoginToken();
  • The method call above, will return the url where you can get the token. The url will redirect you to the call back url specified while creating Yandex Disk API app. In your call back file you can call the following method. It will return the token.
Disk::handleCallback();
  • Having obtained to token, you need to set it.
$disk->setToken('your_token');
  • call this if you want PHP objects returned instead of default JSON strings
$disk->setReturnDecoded();
  • Now, you are ready to use all methods. For example:
$disk->aboutDisk();

You can also:

  • Upload files to your Yandex disk.
$disk->uploadFile('your_file');
  • Download files from your Yandex disk
$disk->downloadOwnFile('file_path');
  • Download files to your Yandex disk.
$disk->downloadOthersFile('url','whatever_you_want_to_name_it');
  • Save public files from Yandex disk to your Yandex disk.
$disk->saveToDisk('url');

-- And many more, see offical documentation

About

This library is built to use Yandex Disk API with PHP in object oriented way.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%