Installation
Install the SDK using Composer:PHP version support: The SDK requires PHP 8.0 or higher. For optimal performance and type safety, we recommend using PHP 8.1 or later.
Quick start
Get up and running in three simple steps:1
Install with Composer
2
Initialize client
3
Capture your first screenshot
Basic usage
Simple screenshot
Capture a basic screenshot with minimal configuration:Advanced screenshot with options
Configure your screenshot with full control over the output:Comprehensive error handling
The SDK provides specific exception types for different failure scenarios:Basic error handling
Handle common errors with try-catch blocks:Exception types reference
Advanced configuration
Custom server URL
Override the default API endpoint for self-hosted instances:Custom HTTP client configuration
Configure custom HTTP client behavior:Real-world examples
Laravel integration
Create a Laravel service for screenshot functionality:Batch processing with queue
Process multiple URLs efficiently using Laravel queues:Symfony integration
Create a Symfony service for screenshot functionality:WordPress plugin integration
Create a WordPress plugin service:Health monitoring
The SDK includes health check endpoints for monitoring your application:Best practices
Performance optimization
Performance optimization
- Use appropriate image formats: WebP for modern browsers, JPEG for smaller sizes, PNG for transparency
- Implement proper caching strategies using the
cacheKeyparameter - Consider image quality vs file size trade-offs (80-90 quality range is often optimal)
- Batch multiple requests efficiently with proper rate limiting
- Use specific selectors to capture only needed content
Error handling
Error handling
- Always wrap API calls in try-catch blocks with specific exception handling
- Implement retry logic with exponential backoff for transient failures
- Log request IDs from error responses for debugging and support
- Provide fallback options when screenshots fail
- Monitor API quota usage to prevent service disruptions
Security considerations
Security considerations
- API keys use domain whitelisting—safe to commit to version control
- Configure allowed domains in your dashboard to control key usage
- Validate and sanitize URLs before sending to the API
- Implement rate limiting in your own applications
- Use environment variables for API keys in production
Memory management
Memory management
- Handle large image data efficiently using streaming when possible
- Clean up temporary files and resources after processing
- Monitor memory usage in batch processing scenarios
- Consider using generators for processing large datasets
- Implement proper garbage collection in long-running processes
Configuration reference
Image formats
Block resources
Available resource types to block during screenshot capture:Operations\BlockResource::Document- HTML documentsOperations\BlockResource::Stylesheet- CSS stylesheetsOperations\BlockResource::Image- ImagesOperations\BlockResource::Media- Audio/video mediaOperations\BlockResource::Font- Web fontsOperations\BlockResource::Script- JavaScript filesOperations\BlockResource::Xhr- XMLHttpRequest callsOperations\BlockResource::Fetch- Fetch API requests
Next steps
API Reference
Explore all available API parameters and response formats
Quickstart Guide
Get started with basic screenshot capture in minutes
Self-hosting
Run Screenshothis on your own infrastructure
GitHub Repository
View source code, report issues, or contribute