PHPackages                             greghunt/laravel-firecrawl - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. greghunt/laravel-firecrawl

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

greghunt/laravel-firecrawl
==========================

Laravel package wrapper for Firecrawl PHP SDK

v0.1.2(6mo ago)0227MITPHPPHP ^8.3CI passing

Since Nov 10Pushed 6mo agoCompare

[ Source](https://github.com/greghunt/laravel-firecrawl)[ Packagist](https://packagist.org/packages/greghunt/laravel-firecrawl)[ RSS](/packages/greghunt-laravel-firecrawl/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (4)Used By (0)

Laravel Firecrawl
=================

[](#laravel-firecrawl)

[![Tests](https://github.com/greghunt/laravel-firecrawl/actions/workflows/tests.yml/badge.svg)](https://github.com/greghunt/laravel-firecrawl/actions/workflows/tests.yml)

A Laravel package wrapper for the [Firecrawl PHP SDK](https://github.com/HelgeSverre/firecrawl-php-sdk), providing a convenient facade and configuration for web scraping and crawling.

Requirements
------------

[](#requirements)

- PHP 8.3 or higher
- Laravel 11.0 or higher

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require greghunt/laravel-firecrawl
```

The package will automatically register itself via Laravel's package discovery.

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=firecrawl-config
```

This will create a `config/firecrawl.php` file where you can customize the package settings.

Add your Firecrawl API key to your `.env` file:

```
FIRECRAWL_API_KEY=your-api-key-here
```

### Configuration Options

[](#configuration-options)

All configuration options can be set via environment variables:

```
FIRECRAWL_API_KEY=your-api-key-here
FIRECRAWL_API_URL=https://api.firecrawl.dev/
FIRECRAWL_TIMEOUT_MS=60000
FIRECRAWL_MAX_RETRIES=3
FIRECRAWL_BACKOFF_FACTOR=0.5
```

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

The easiest way to use Firecrawl is through the facade:

```
use GregHunt\LaravelFirecrawl\Facades\Firecrawl;

// Scrape a single page
$result = Firecrawl::scrape('https://example.com');

// Access the scraped content
echo $result->markdown;
echo $result->html;
```

### Dependency Injection

[](#dependency-injection)

You can also inject the Firecrawl client into your classes:

```
use HelgeSverre\Firecrawl\FirecrawlClient;

class YourController extends Controller
{
    public function __construct(
        protected FirecrawlClient $firecrawl
    ) {}

    public function scrape()
    {
        $result = $this->firecrawl->scrape('https://example.com');
        return response()->json($result);
    }
}
```

Features
--------

[](#features)

### Scraping

[](#scraping)

Scrape a single webpage:

```
use GregHunt\LaravelFirecrawl\Facades\Firecrawl;

$result = Firecrawl::scrape('https://example.com', [
    'formats' => ['markdown', 'html', 'links'],
    'onlyMainContent' => true,
]);

echo $result->markdown;
```

### Crawling

[](#crawling)

Start an asynchronous crawl:

```
$job = Firecrawl::startCrawl('https://example.com', [
    'limit' => 100,
    'maxDepth' => 3,
]);

// Check crawl status
$status = Firecrawl::getCrawlStatus($job->id);

// Or use blocking crawl that waits for completion
$result = Firecrawl::crawl('https://example.com', [
    'limit' => 10,
]);
```

### Batch Scraping

[](#batch-scraping)

Scrape multiple URLs at once:

```
$urls = [
    'https://example.com/page1',
    'https://example.com/page2',
    'https://example.com/page3',
];

$result = Firecrawl::batchScrape($urls);

foreach ($result->data as $page) {
    echo $page->markdown;
}
```

### Site Mapping

[](#site-mapping)

Generate a site structure map:

```
$map = Firecrawl::map('https://example.com', [
    'search' => 'blog/*',
]);

foreach ($map->links as $link) {
    echo $link;
}
```

### Search

[](#search)

Search for content:

```
$results = Firecrawl::search('Laravel tutorials', [
    'limit' => 10,
]);

foreach ($results->data as $result) {
    echo $result->title;
    echo $result->url;
}
```

### Data Extraction

[](#data-extraction)

Extract structured data using AI:

```
$urls = ['https://example.com/product'];

$result = Firecrawl::extract($urls, [
    'prompt' => 'Extract product name, price, and description',
]);
```

Advanced Options
----------------

[](#advanced-options)

### Custom Scraping Options

[](#custom-scraping-options)

```
$result = Firecrawl::scrape('https://example.com', [
    'formats' => ['markdown', 'html', 'links', 'screenshot'],
    'onlyMainContent' => true,
    'includeTags' => ['article', 'main'],
    'excludeTags' => ['nav', 'footer'],
    'headers' => [
        'User-Agent' => 'Custom Agent',
    ],
    'waitFor' => 1000, // Wait 1 second before scraping
    'mobile' => true,  // Use mobile viewport
]);
```

### Crawl Options

[](#crawl-options)

```
$result = Firecrawl::crawl('https://example.com', [
    'limit' => 100,
    'maxDepth' => 3,
    'allowBackwardLinks' => false,
    'allowExternalLinks' => false,
    'includePaths' => ['/blog/*'],
    'excludePaths' => ['/admin/*'],
    'webhook' => 'https://your-app.com/webhook',
]);
```

Error Handling
--------------

[](#error-handling)

The package uses the exceptions from the underlying Firecrawl SDK:

```
use HelgeSverre\Firecrawl\Exceptions\FirecrawlException;

try {
    $result = Firecrawl::scrape('https://example.com');
} catch (FirecrawlException $e) {
    Log::error('Firecrawl error: ' . $e->getMessage());
}
```

Testing
-------

[](#testing)

### Running Package Tests

[](#running-package-tests)

This package includes a comprehensive test suite. To run the tests:

```
composer test
```

The test suite includes:

- Service Provider registration tests
- Facade functionality tests
- Configuration tests
- Dependency injection tests

All tests use Orchestra Testbench to simulate a Laravel environment.

### Testing Your Implementation

[](#testing-your-implementation)

When testing your application code that uses this package, you can mock the Firecrawl facade:

```
use GregHunt\LaravelFirecrawl\Facades\Firecrawl;
use HelgeSverre\Firecrawl\Data\ScrapeResult;

Firecrawl::shouldReceive('scrape')
    ->once()
    ->with('https://example.com')
    ->andReturn(new ScrapeResult(
        markdown: '# Test Content',
        success: true,
    ));
```

Alternatively, you can mock the `FirecrawlClient` in the container:

```
use HelgeSverre\Firecrawl\FirecrawlClient;
use Mockery\MockInterface;

$this->mock(FirecrawlClient::class, function (MockInterface $mock) {
    $mock->shouldReceive('scrape')
        ->once()
        ->andReturn(/* mocked response */);
});
```

Credits
-------

[](#credits)

- [Greg Hunt](https://greghunt.dev)
- [Helge Sverre](https://github.com/HelgeSverre) - Original PHP SDK
- [Firecrawl](https://firecrawl.dev) - Web scraping service
- [Claude 4.5 Sonnet](https://claude.ai) - AI agent

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for more information.

Links
-----

[](#links)

- [Firecrawl Website](https://firecrawl.dev)
- [Firecrawl PHP SDK](https://github.com/HelgeSverre/firecrawl-php-sdk)
- [Laravel Documentation](https://laravel.com/docs)

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance69

Regular maintenance activity

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

184d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/de81fafa7b25ffcbdfd3aa7d78a7a3c05a764a8e15a73b6f37ea7cfa4348abd2?d=identicon)[greghunt](/maintainers/greghunt)

---

Top Contributors

[![greghunt](https://avatars.githubusercontent.com/u/1238407?v=4)](https://github.com/greghunt "greghunt (5 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/greghunt-laravel-firecrawl/health.svg)

```
[![Health](https://phpackages.com/badges/greghunt-laravel-firecrawl/health.svg)](https://phpackages.com/packages/greghunt-laravel-firecrawl)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
