This library is built to deal with Yandex Disk API.
composer require siyahmadde/yandex-disk-api
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