1. Go to this page and download the library: Download danog/tg-file-decoder 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/ */
danog / tg-file-decoder example snippets
use danog\Decoder\FileId;
use danog\Decoder\UniqueFileId;
$fileId = FileId::fromBotAPI('CAACAgQAAxkDAAJEsl44nl3yxPZ8biI8uhaA7rbQceOSAAKtAQACsTisUXvMEbVnTuQkGAQ');
$version = $fileId->version; // bot API file ID version, usually 4
$subVersion = $fileId->subVersion; // bot API file ID subversion, equivalent to a specific tdlib version
$dcId = $fileId->dcId; // On which datacenter is this file stored
$type = $fileId->type; // File type
$id = $fileId->id;
$accessHash = $fileId->accessHash;
$fileReference = $fileId->fileReference; // File reference, https://core.telegram.org/api/file_reference
$url = $fileId->url; // URL, file IDs with encoded webLocation
// You can also use hasFileReference and hasUrl
$fileIdReencoded = $fileId->getBotAPI(); // CAACAgQAAxkDAAJEsl44nl3yxPZ8biI8uhaA7rbQceOSAAKtAQACsTisUXvMEbVnTuQkGAQ
$fileIdReencoded = (string) $fileId; // CAACAgQAAxkDAAJEsl44nl3yxPZ8biI8uhaA7rbQceOSAAKtAQACsTisUXvMEbVnTuQkGAQ
// For photos, thumbnails if ($fileId->getType() <= FileIdType::PHOTO->value)
$volumeId = $fileId->volumeId;
$localId = $fileId->localId;
$photoSizeSource = $fileId->photoSizeSource; // PhotoSizeSource object
$photoSizeSource->dialogId;
$photoSizeSource->stickerSetId;
// And more, depending on photosize source
$uniqueFileId = UniqueFileId::fromUniqueBotAPI('AgADrQEAArE4rFE');
$type = $fileId->type; // Unique file type
$id = $uniqueFileId->id;
$url = $uniqueFileId->url; // URL, for unique file IDs with encoded webLocation
// For photos
$volumeId = $uniqueFileId->volumeId;
$localId = $uniqueFileId->localId;