1. Go to this page and download the library: Download yannelli/pocket-laravel 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/ */
use Yannelli\Pocket\Facades\Pocket;
// List recordings
$recordings = Pocket::recordings()->list();
// Get a specific recording
$recording = Pocket::recordings()->get('rec_123');
// Search transcripts, summaries, and action items
$results = Pocket::search()->query('ship v2 by Friday');
// List folders
$folders = Pocket::folders()->list();
// List tags
$tags = Pocket::tags()->list();
use Yannelli\Pocket\Pocket;
class RecordingController extends Controller
{
public function __construct(
private Pocket $pocket
) {}
public function index()
{
return $this->pocket->recordings()->list();
}
}
use Yannelli\Pocket\Facades\Pocket;
// Create a tenant-specific instance
$tenantPocket = Pocket::withApiKey($tenant->pocket_api_key);
// Use the tenant-specific instance
$recordings = $tenantPocket->recordings()->list();
use Yannelli\Pocket\Pocket;
class TenantRecordingService
{
public function __construct(
private Pocket $pocket
) {}
public function getRecordingsForTenant(Tenant $tenant)
{
return $this->pocket
->withApiKey($tenant->pocket_api_key)
->recordings()
->list();
}
}
use Yannelli\Pocket\Facades\Pocket;
$recordings = Pocket::recordings()->list();
foreach ($recordings as $recording) {
echo $recording->title;
echo $recording->formattedDuration(); // "1:30:45"
}
if ($recordings->hasMore()) {
$nextPage = Pocket::recordings()->list(page: $recordings->nextPage());
}
$upload = Pocket::recordings()->createUploadUrl(
contentType: 'audio/mpeg',
fileName: 'standup.mp3',
duration: 1800,
title: 'Team Standup'
);
// Or create the URL and upload a local file in one call:
$upload = Pocket::recordings()->upload(
path: storage_path('app/standup.mp3'),
title: 'Team Standup'
);
$recording = Pocket::recordings()->get($upload->recordingId);
$recording = Pocket::recordings()->get('rec_123');
if ($recording->hasTranscript()) {
// Access the full transcript text
echo $recording->transcript->text;
// Get a list of speakers
$speakers = $recording->transcript->speakers();
// Retrieve segments for a specific speaker
$segments = $recording->transcript->segmentsForSpeaker('Speaker 1');
}
if ($recording->hasSummary()) {
echo $recording->summary->title;
foreach ($recording->summary->sections as $section) {
echo $section->heading;
echo $section->content;
}
}
if ($recording->hasActionItems()) {
// Filter by status
$pendingItems = $recording->pendingActionItems();
$completedItems = $recording->completedActionItems();
foreach ($recording->actionItems as $item) {
echo $item->title;
echo $item->priority->label(); // "High", "Medium", "Low"
if ($item->isOverdue()) {
// Handle overdue item...
}
}
}
$recording = Pocket::recordings()->get('rec_123');
if ($recording->isProcessing()) {
echo "Recording is being processed...";
}
if ($recording->isCompleted()) {
echo "Recording is ready!";
}
if ($recording->isFailed()) {
echo "Processing failed: " . $recording->state->description();
}
use Yannelli\Pocket\Facades\Pocket;
// List all folders
$folders = Pocket::folders()->list();
foreach ($folders as $folder) {
echo $folder->name;
echo $folder->recordingCount;
}
// Find a folder by ID, including nested children
$folder = Pocket::folders()->find('folder_123');
// Find a folder by name
$folder = Pocket::folders()->findByName('Work Meetings');
// Get the default folder when the API marks one with is_default
$defaultFolder = Pocket::folders()->default();
use Yannelli\Pocket\Facades\Pocket;
// List all tags (ordered by usage)
$tags = Pocket::tags()->list();
// Get most used tags
$topTags = Pocket::tags()->mostUsed(5);
// Find a tag by ID
$tag = Pocket::tags()->find('tag_123');
// Find a tag by name
$tag = Pocket::tags()->findByName('Important');
use Yannelli\Pocket\Facades\Pocket;
$audioUrl = Pocket::audio()->getUrl('rec_123');
echo $audioUrl->signedUrl;
echo $audioUrl->expiresIn; // Seconds until expiry
if ($audioUrl->isExpired()) {
$audioUrl = Pocket::audio()->getUrl('rec_123');
}
// Get the audio file contents as a string
$contents = Pocket::audio()->getContents('rec_123');
// Stream the audio file (memory efficient for large files)
$stream = Pocket::audio()->stream('rec_123');
// Download to a temporary file (auto-cleaned up on script end)
$tempPath = Pocket::audio()->download('rec_123');
// Save to a Laravel storage disk
Pocket::audio()->saveTo('recordings/audio.mp3', 's3', [], 'rec_123');
// Save using streaming (memory efficient)
Pocket::audio()->saveStreamTo('recordings/audio.mp3', 'local', [], 'rec_123');
// Save directly to a local path
Pocket::audio()->saveToPath('/path/to/audio.mp3', 'rec_123');
use Yannelli\Pocket\Resources\AudioResource;
AudioResource::cleanup();
$audio = Pocket::audio('rec_123');
// All methods now work without passing the recording ID
$url = $audio->getUrl();
$contents = $audio->getContents();
$tempPath = $audio->download();