Download the PHP package rkdhatterwal/decodo-scraper without Composer
On this page you can find all versions of the php package rkdhatterwal/decodo-scraper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rkdhatterwal/decodo-scraper
More information about rkdhatterwal/decodo-scraper
Files in rkdhatterwal/decodo-scraper
Package decodo-scraper
Short Description A Laravel package for the Decodo Web Scraping API — real-time, async, webhooks, DB tracking, caching, and testing helpers
License MIT
Informations about the package decodo-scraper
Decodo Scraper for Laravel
A clean, well-tested Laravel wrapper for the Decodo Web Scraping API — supports both real-time (v2) and async/batch (v3) scraping.
Requirements
- PHP 8.1+
- Laravel 10, 11, 12, or 13
Installation
Publish the config and migrations:
Add credentials to .env:
Your token is in the Decodo dashboard under Scraping APIs → Username / Token.
Real-time Scraping (v2)
Use the Decodo facade or inject DecodoClient.
Full control with PayloadBuilder
Database Tracking
When database.enabled is true (default), the package automatically tracks every async task and batch in your database using the decodo_tasks and decodo_batches tables.
Models
Rkdhatterwal\DecodoScraper\Models\DecodoTaskRkdhatterwal\DecodoScraper\Models\DecodoBatch
You can associate a task with one of your own models (e.g., a Product or Lead) by passing it to queueTask:
Async Scraping (v3)
Use the DecodoAsync facade or inject AsyncDecodoClient.
Queue a single task
Queue with PayloadBuilder
You can also use the PayloadBuilder with async tasks for a more fluent experience:
Queue a batch
Decodo enforces a 1-request-per-second rate limit on batch submissions. The package handles this for you automatically.
Check status & retrieve results
v3 Batch Format
Decodo v3 supports passing an array of URLs in a single request. The package handles this via queueBatch or by passing URLs to buildBatch() in the PayloadBuilder:
Webhooks
The package includes a built-in webhook handler that automatically updates your local database records when Decodo tasks complete.
Setup
- Ensure
webhook.enabledistruein your config. - Configure a
DECODO_WEBHOOK_SECRETin your.envto enable passthrough verification. - Exempt the webhook path from CSRF protection in
app/Http/Middleware/VerifyCsrfToken.php(Laravel 10) or yourbootstrap/app.php(Laravel 11+):
Security
The built-in webhook handler uses the VerifyDecodoWebhook middleware to ensure callbacks are authentic. It compares the passthrough value from the request against your configured secret using hash_equals.
Automatic Injection
When webhook.auto_inject_callback is enabled, the package will automatically append the correct callback_url to every async request. You don't need to pass it manually unless you want to override it.
Result Caching
To avoid redundant API calls and save credits, enable the DecodoResultCache. It caches results for "done" tasks (which are immutable) for up to 23 hours.
Logging
The package includes a DecodoLogger that routes all package-specific activities to a Laravel log channel. By default, it uses your application's default channel.
To isolate Decodo logs, set the channel in config/decodo.php:
And add the channel to your config/logging.php:
Events
You can listen for the following events to trigger your own logic:
Rkdhatterwal\DecodoScraper\Events\DecodoTaskCompletedRkdhatterwal\DecodoScraper\Events\DecodoTaskFaultedRkdhatterwal\DecodoScraper\Events\DecodoTaskExpiredRkdhatterwal\DecodoScraper\Events\DecodoBatchCompleted
Artisan Commands
php artisan decodo:status {taskId}— Check the status of a specific task.php artisan decodo:retry {taskId}— Retry a faulted task.php artisan decodo:prune— Clean up old database records.
Pruning Configuration
Configure retention periods in config/decodo.php:
DTOs & Public Properties
All DTOs in this package use PHP 8.1+ public readonly properties for a better developer experience. You can access properties directly: echo $result->content;.
ScrapeResult DTO
| Property | Type | Description |
|---|---|---|
content |
string |
Raw HTML, Markdown, or parsed JSON |
statusCode |
int |
HTTP status of the upstream page |
url |
string |
The URL that was scraped |
taskId |
string |
Decodo task ID |
createdAt |
string |
Task creation timestamp |
updatedAt |
string |
Task completion timestamp |
TaskResponse DTO
Returned by queueTask() and getTaskStatus().
| Property | Type | Description |
|---|---|---|
id |
string |
Decodo task ID |
status |
string |
pending, done, or faulted |
url |
string |
Target URL |
target |
?string |
Scraper template target |
geo |
?string |
Geographical location |
domain |
string |
TLD used |
deviceType |
string |
desktop, mobile, or tablet |
httpMethod |
string |
get or post |
createdAt |
string |
Creation timestamp |
updatedAt |
string |
Last update timestamp |
BatchTaskResponse DTO
Returned by queueBatch().
All Payload Parameters
See the Decodo parameters docs.
| Method on PayloadBuilder | API Parameter | Default |
|---|---|---|
->url($url) |
url |
required |
->query($q) |
query |
— |
->target($t) |
target |
null |
->proxyPool('standard') |
proxy_pool |
premium |
->headless('html'/'png') |
headless |
null |
->geo('United States') |
geo |
auto |
->domain('co.uk') |
domain |
com |
->locale('en-GB') |
locale |
matched |
->headers([...]) |
headers |
null |
->forceHeaders() |
force_headers |
false |
->cookies([...]) |
cookies |
null |
->forceCookies() |
force_cookies |
false |
->deviceType('mobile') |
device_type |
desktop |
->parse() |
parse |
false |
->sessionId('1234') |
session_id |
null |
->httpMethod('post') |
http_method |
get |
->payload($body) |
payload (base64) |
null |
->successfulStatusCodes([]) |
successful_status_codes |
null |
->markdown() |
markdown |
false |
->xhr() |
xhr |
false |
->callbackUrl($url) |
callback_url |
null |
->passthrough($val) |
passthrough |
null |
Testing
The package provides a powerful DecodoFake helper to mock API responses and assert that requests were sent.
For async tasks:
For batches:
Other Assertions & Helpers
Changelog
See CHANGELOG.md.
License
MIT
All versions of decodo-scraper with dependencies
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0
illuminate/events Version ^10.0|^11.0|^12.0|^13.0
illuminate/cache Version ^10.0|^11.0|^12.0|^13.0
illuminate/console Version ^10.0|^11.0|^12.0|^13.0