Download the PHP package yannelli/pocket-laravel without Composer
On this page you can find all versions of the php package yannelli/pocket-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yannelli/pocket-laravel
More information about yannelli/pocket-laravel
Files in yannelli/pocket-laravel
Package pocket-laravel
Short Description Laravel SDK for the Pocket API - Access recordings, transcripts, summaries, search, and more
License MIT
Homepage https://github.com/yannelli/pocket-laravel
Informations about the package pocket-laravel
Pocket Laravel SDK
- Introduction
- Installation
- Configuration
- Making Requests
- Using the Facade
- Using Dependency Injection
- Multi-Tenant Applications
- Recordings
- Retrieving Recordings
- Filtering Recordings
- Iterating All Recordings
- Recording Details
- Uploading Recordings
- Transcripts
- Summaries
- Action Items
- Recording States
- Search
- Folders
- Tags
- Audio
- Retrieving Audio URLs
- Downloading Audio
- Scoped Audio Resource
- Users
- Webhooks
- Error Handling
- Configuration Reference
- Testing
- Disclaimer
Introduction
Pocket Laravel SDK provides an expressive, fluent interface for interacting with the Pocket API. Using this SDK, you may easily access your recordings, transcripts, summaries, search, tags, folders, and action items from within your Laravel application.
The SDK handles authentication, request building, pagination, retry logic with exponential backoff, and exception mapping—allowing you to focus on building your application rather than managing HTTP requests.
Installation
You may install the Pocket Laravel SDK via the Composer package manager:
After installing the package, the service provider will be automatically registered via Laravel's package discovery.
Configuration
Before using the SDK, you will need to configure your Pocket API credentials. First, publish the configuration file using the vendor:publish Artisan command:
This command will publish a pocket.php configuration file to your application's config directory:
Next, add your Pocket API key to your application's .env file:
Making Requests
Using the Facade
The SDK provides a Pocket facade that allows you to fluently access all available resources:
Using Dependency Injection
If you prefer dependency injection, you may type-hint the Pocket class in your controller's constructor or method signatures. The SDK's service provider binds the Pocket class as a singleton, ensuring the same instance is resolved throughout your application:
Multi-Tenant Applications
For multi-tenant applications where each tenant may have their own Pocket API key, you may use the withApiKey method to create a new SDK instance with a different API key. All other configuration options are preserved from the original instance:
You may also create multiple tenant instances from a single base configuration:
[!NOTE] The
withApiKeymethod returns a new
Recordings
The recordings resource provides methods for listing, filtering, and retrieving recordings along with their associated transcripts, summaries, and action items.
Retrieving Recordings
To retrieve a paginated list of recordings, you may use the list method:
The list method returns a PaginatedRecordings instance. You may check for additional pages and retrieve subsequent results:
To retrieve a single recording by its ID, use the get method:
Filtering Recordings
The recordings resource provides several convenient methods for filtering results. You may filter recordings by folder:
To filter by tags, pass an array of tag IDs to the withTags method:
You may also filter recordings within a specific date range:
For more complex filtering, the list method accepts all filter parameters directly:
Iterating All Recordings
When you need to process all recordings, the all method returns a generator that automatically handles pagination:
You may also apply filters when iterating all recordings:
[!NOTE] The
allmethod uses PHP generators to efficiently iterate through large result sets without loading all recordings into memory at once.
Recording Details
When retrieving a single recording, you may control which related data is included in the response. By default, all related data is included. To exclude specific data and improve response times:
Uploading Recordings
User API keys with the recordings:write scope may create a pre-signed upload URL and PUT audio to it. Organization API keys are not allowed for this endpoint.
Transcripts
Recordings may include transcript data with speaker identification and time-coded segments. You may access the transcript through the recording instance:
Summaries
Recordings may include AI-generated summaries organized into sections:
Action Items
Recordings may include extracted action items with priority levels and completion status:
Recording States
Recordings progress through various processing states. You may inspect a recording's current state using the following methods:
The available recording states are: pending, transcribing, failed, transcribed, summarizing, summarization_failed, completed, and unknown.
Search
Semantic search finds relevant content across transcripts, summaries, and action items:
Limit is capped at 20, matching the public API.
Folders
The folders resource returns the authenticated user's folder hierarchy, including nested children, recording counts, and spaces:
Tags
The tags resource provides methods for listing and finding tags:
Audio
The audio resource provides methods for accessing and downloading audio files associated with recordings.
Retrieving Audio URLs
To get a signed URL for a recording's audio file:
Signed URLs expire after a period of time. You may check if a URL has expired and retrieve a fresh one:
Downloading Audio
The SDK provides several methods for downloading audio content:
You may also save audio files directly to Laravel's filesystem:
To manually clean up temporary files created by the download method:
Scoped Audio Resource
When working with a single recording's audio, you may create a scoped audio resource to simplify method calls:
Users
Organization API keys with the users:read / users:write scopes can list members and administer settings. Personal user API keys are rejected on these routes.
Webhooks
Personal webhooks are configured in the Pocket app. The SDK verifies HMAC-SHA256 signatures from the X-HeyPocket-Signature and X-HeyPocket-Timestamp headers:
Organization-prefixed admin APIs (/api/v1/organization/:orgId/... for templates, API keys, analytics, and org webhooks) are documented by Pocket but are not wrapped by this SDK yet. The public /public/users aliases above cover org member administration.
Error Handling
The SDK throws specific exceptions based on the HTTP response status code. You may catch these exceptions to handle different error conditions:
[!NOTE] The
RateLimitExceptionprovides agetRetryAfter()method that returns the number of seconds you should wait before making another request.
Configuration Reference
The following configuration options are available:
| Option | Environment Variable | Default | Description |
|---|---|---|---|
api_key |
POCKET_API_KEY |
— | Your Pocket API key |
base_url |
POCKET_BASE_URL |
https://public.heypocketai.com |
API base URL |
api_version |
POCKET_API_VERSION |
v1 |
API version |
timeout |
POCKET_TIMEOUT |
30 |
Request timeout in seconds |
retry.times |
POCKET_RETRY_TIMES |
3 |
Number of retry attempts |
retry.sleep |
POCKET_RETRY_SLEEP |
1000 |
Retry delay in milliseconds |
Testing
To run the SDK's test suite:
Disclaimer
This is an unofficial SDK for the Pocket API, developed and maintained by Ryan Yannelli. It is not affiliated with, endorsed by, or officially connected to Pocket and Open Vision Engineering Inc any way. Use at your own risk. No warranties or guarantees are provided.
Requirements
- PHP 8.3 or higher
- Laravel 12.x or 13.x
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of pocket-laravel with dependencies
guzzlehttp/guzzle Version ^7.8
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^10.0||^11.0||^12.0||^13.0
illuminate/support Version ^10.0||^11.0||^12.0||^13.0