eelcol/laravel-scrapers
Laravel Scrapers
A Laravel package to scrape webpages using ScrapingBee and/or ScraperApi.
Examples
- Scrape an URL:
$response = Scraper::get('https://www.nu.nl');
- Scrape an image:
$response = Scraper::image('https://via.placeholder.it/250x250.png');
- Use a specific scraper:
$response = Scraper::provider('scraperapi')->get('https://www.nu.nl');
- Use premium proxies:
$response = Scraper::premium()->get('https://www.nu.nl');
- When writing a test that triggers the scraper, you probably do not want to use ScraperAPI or ScrapingBee. In that case, include the test method in your test:
...
Scraper::test();
...
Installation
Require this package with composer.
composer require eelcol/laravel-scrapers
Add to your env:
SCRAPER_PROVIDER=see below
SCRAPER_MAX_CONCURRENCY=5
SCRAPERAPI_KEY=
SCRAPINGBEE_KEY=
When using a different proxy, add the following variables to your .env:
SCRAPER_PROXY_HOST=
SCRAPER_PROXY_PORT=
SCRAPER_PROXY_USER=
SCRAPER_PROXY_PASS=
The following values are allowed for SCRAPER_PROVIDER
- scrapingbee
- scraperapi
- http
- proxy
Use http for normal HTTP requests, without using a scraper provider. Use proxy to use a custom defined proxy.
Run tests using Docker
Use the following command to run the tests:
docker run --rm -v "$(pwd):/app" -w /app php:8.2-cli bash -c "apt-get update && apt-get install -y git unzip && curl -sS https://getcomposer.org/installer | php && mv composer.phar /usr/local/bin/composer && composer install --no-interaction && vendor/bin/phpunit"
Related Packages
Powerful PHP database abstraction layer (DBAL) with many features for database s...
Laravel Serializable Closure provides an easy and secure way to serialize closur...
Cli error handling for console/command-line PHP applications.
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.2.6 | ^8.0 | ^8| | MIT | |
| 1.2.5 | ^8.0 | ^8| | MIT | |
| 1.2.4 | ^8.0 | ^8| | MIT | |
| 1.2.3 | ^8.0 | ^8| | MIT | |
| 1.2.2 | ^8.0 | ^8| | MIT | |
| 1.2.1 | ^8.0 | ^8| | MIT | |
| 1.2.0 | ^8.0 | ^8| | MIT | |
| 1.1.27 | ^8.0 | ^8| | MIT | |
| 1.1.26 | ^8.0 | ^8| | MIT | |
| 1.1.25 | ^8.0 | ^8| | MIT | |
| 1.1.24 | ^8.0 | ^8| | MIT | |
| 1.1.23 | ^8.0 | ^8| | MIT | |
| 1.1.22 | ^8.0 | ^9| | MIT | |
| 1.1.21 | ^8.0 | ^9| | MIT | |
| 1.1.20 | ^8.0 | ^9| | MIT | |
| 1.1.19 | ^8.0 | ^9| | MIT | |
| 1.1.18 | ^8.0 | ^9| | MIT | |
| 1.1.17 | ^8.0 | ^9| | MIT | |
| 1.1.16 | ^8.0 | ^9| | MIT | |
| 1.1.15 | ^8.0 | ^9| | MIT | |
| 1.1.14 | ^8.0 | ^9| | MIT | |
| 1.1.13 | ^8.0 | ^9| | MIT | |
| 1.1.12 | ^8.0 | ^9| | MIT | |
| 1.1.11 | ^8.0 | ^9| | MIT | |
| 1.1.10 | ^8.0 | ^9| | MIT | |
| 1.1.9 | ^8.0 | ^9| | MIT | |
| 1.1.8 | ^8.0 | ^9| | MIT | |
| 1.1.7 | ^8.0 | ^9| | MIT | |
| 1.1.6 | ^8.0 | ^9| | MIT | |
| 1.1.5 | ^8.0 | ^9| | MIT |
Showing the latest 30 of 40. See every release on Packagist