Download the PHP package shammaa/laravel-smart-scraper without Composer

On this page you can find all versions of the php package shammaa/laravel-smart-scraper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-smart-scraper

Laravel Smart Scraper

Latest Version Total Downloads License

Advanced intelligent web scraper for Laravel with caching, rate limiting, middleware, monitoring, and much more. Built on Puppeteer with smart features that make web scraping professional, efficient, and reliable.

🚀 Key Features

📦 Installation

Install the package via Composer:

Publish the configuration file:

Install Node.js dependencies (required for Puppeteer):

Note: Make sure Node.js is installed and available in your PATH. If using NVM, see the NVM Configuration section below.

🎯 Quick Start

1. Create a Scraper

Generate a scraper class using the Artisan command:

This creates a file at app/Scrapers/ProductScraper.php:

2. Use the Scraper

📚 Basic Usage

Simple Scraping

With Options

With Parameters

You can pass parameters to the handle() method:

Then use it:

🔧 Advanced Features

Caching

The scraper automatically caches results to avoid redundant requests:

Cache TTL can be configured in config/smart-scraper.php:

Rate Limiting

Prevent overwhelming target websites with rate limiting:

Configure rate limits in config/smart-scraper.php:

User-Agent Rotation

User agents are automatically rotated to avoid detection:

Configure user agents in config/smart-scraper.php:

Proxy Support

Full proxy support with authentication:

Retry Logic

Automatic retry with exponential backoff:

Configure default retry settings in config/smart-scraper.php:

Screenshots

Capture screenshots of web pages:

PDF Generation

Generate PDFs from web pages:

Custom Headers

Add custom headers to requests:

Data Validation

Validate extracted data against a schema:

Middleware

Create custom middleware to modify requests:

🎨 Artisan Commands

Create a Scraper

List All Scrapers

Test a Scraper

🧠 Smart Site Detection & Multi-Site Support

The scraper can intelligently detect different websites and automatically use the appropriate selectors for each site. This means you can scrape multiple websites with different HTML structures using the same scraper class!

How It Works

  1. Automatic Site Detection - The scraper detects the site type from URL patterns or HTML patterns
  2. Smart Selectors - Uses site-specific selectors if available, falls back to generic selectors
  3. Fallback System - If a selector fails, it automatically tries the next one

Creating a Smart Scraper

Use the --smart flag when creating a scraper:

This creates a scraper with smart selectors:

Smart Selector Methods

extract() - Extract text content

Tries multiple selectors until one works:

extractAttribute() - Extract attribute value

Tries multiple selectors to extract an attribute:

extractMultiple() - Extract array of values

Extracts multiple elements:

Site Profiles

Define site profiles in config/smart-scraper.php:

How Site Detection Works

  1. URL Pattern Matching - First, tries to match URL patterns
  2. HTML Pattern Matching - If URL doesn't match, analyzes HTML structure
  3. Selector Priority - Uses site-specific selectors first, then falls back to generic ones

Example: Scraping Multiple Sites

The same scraper automatically adapts to each site's structure!

Manual Site Type Detection

You can also manually set or check the site type:

🔍 Monitoring & Logging

Monitoring is enabled by default. All scraping activities are logged:

Check logs in storage/logs/laravel.log:

Configure monitoring in config/smart-scraper.php:

⚙️ Configuration

All configuration options are available in config/smart-scraper.php:

🐛 Troubleshooting

NVM Configuration

If you're using Node.js via NVM and running scrapers via scheduled tasks, Node might not be available. To fix this:

  1. Edit your ~/.bash_profile:

  2. Add at the top:

  3. Reload:

Note: It's not recommended to use NVM in production environments.

Common Issues

Issue: Puppeteer execution failed

Solution: Make sure Node.js and Puppeteer dependencies are installed:

Issue: Rate limit exceeded

Solution: Adjust rate limit settings or disable rate limiting:

Issue: Data validation failed

Solution: Check your validation schema and ensure data matches expected types.

📝 Examples

Example 1: E-commerce Product Scraper

Example 2: News Article Scraper

Example 3: Multiple URLs Concurrently

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This package is open-sourced software licensed under the MIT license.

🙏 Credits

Built with ❤️ by Shadi Shammaa


Made with Laravel Smart Scraper - Professional web scraping made easy! 🚀


All versions of laravel-smart-scraper with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/console Version ^9.0|^10.0|^11.0|^12.0
illuminate/queue Version ^9.0|^10.0|^11.0|^12.0
symfony/dom-crawler Version ^5.0|^6.0|^7.0
symfony/css-selector Version ^5.0|^6.0|^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package shammaa/laravel-smart-scraper contains the following files

Loading the files please wait ...