PHP code example of gflaminio3 / telara
1. Go to this page and download the library: Download gflaminio3/telara 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/ */
gflaminio3 / telara example snippets
'disks' => [
'telegram' => [
'driver' => 'telara',
'bot_token' => env('TELEGRAM_BOT_TOKEN'),
'chat_id' => env('TELEGRAM_CHAT_ID'),
],
],
use Illuminate\Support\Facades\Storage;
// Upload a file
Storage::disk('telegram')->put('document.pdf', file_get_contents('path/to/file.pdf'));
// Upload with caption
Storage::disk('telegram')->put('image.jpg', $contents, ['caption' => 'My image']);
// Download a file
$contents = Storage::disk('telegram')->get('document.pdf');
// Check existence
if (Storage::disk('telegram')->exists('document.pdf')) {
// File exists
}
// Delete from tracker
Storage::disk('telegram')->delete('document.pdf');
// This file will be chunked automatically
$largeFile = str_repeat('A', 50 * 1024 * 1024); // 50MB
Storage::disk('telegram')->put('large.bin', $largeFile);
// Download - chunks are merged automatically
$retrieved = Storage::disk('telegram')->get('large.bin');
// Upload - encrypted automatically
Storage::disk('telegram')->put('secret.txt', 'Sensitive data');
// Download - decrypted automatically
$plaintext = Storage::disk('telegram')->get('secret.txt');
$files = DB::table('telara_files')->get();
// Check if chunked/encrypted
$file = DB::table('telara_files')->where('path', 'large.bin')->first();
echo $file->is_chunked; // true/false
echo $file->is_encrypted; // true/false
bash
php artisan vendor:publish --tag=telara-config
bash
php artisan migrate
bash
php artisan telara:configure