Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat(php-sdk): add FirecrawlTools::all() helper

Kris Oeie27964007456
diff --git a/apps/php-sdk/src/Laravel/Tools/FirecrawlTools.php b/apps/php-sdk/src/Laravel/Tools/FirecrawlTools.php
new file mode 100644
index 000000000..945d3d4f3
--- /dev/null
+++ b/apps/php-sdk/src/Laravel/Tools/FirecrawlTools.php
@@ -0,0 +1,28 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Firecrawl\Laravel\Tools;
+
+use Firecrawl\Client\FirecrawlClient;
+
+final class FirecrawlTools
+{
+ private function __construct() {}
+
+ /**
+ * All core Firecrawl tools, ready to spread into an agent's tools() array:
+ * `return [...FirecrawlTools::all()];`
+ *
+ * @return list<FirecrawlTool>
+ */
+ public static function all(?FirecrawlClient $client = null): array
+ {
+ return [
+ new FirecrawlScrape($client),
+ new FirecrawlSearch($client),
+ new FirecrawlMap($client),
+ new FirecrawlCrawl($client),
+ ];
+ }
+}
diff --git a/apps/php-sdk/tests/Unit/LaravelTools/FirecrawlToolsTest.php b/apps/php-sdk/tests/Unit/LaravelTools/FirecrawlToolsTest.php
new file mode 100644
index 000000000..5150d9650
--- /dev/null
+++ b/apps/php-sdk/tests/Unit/LaravelTools/FirecrawlToolsTest.php
@@ -0,0 +1,32 @@
+<?php
+
+declare(strict_types=1);
+
+use Firecrawl\Laravel\Tools\FirecrawlCrawl;
+use Firecrawl\Laravel\Tools\FirecrawlMap;
+use Firecrawl\Laravel\Tools\FirecrawlScrape;
+use Firecrawl\Laravel\Tools\FirecrawlSearch;
+use Firecrawl\Laravel\Tools\FirecrawlTools;
+use GuzzleHttp\Psr7\Response;
+use Laravel\Ai\Tools\Request;
+
+it('returns one instance of each core tool', function (): void {
+ $tools = FirecrawlTools::all();
+
+ expect($tools)->toHaveCount(4);
+ expect($tools[0])->toBeInstanceOf(FirecrawlScrape::class);
+ expect($tools[1])->toBeInstanceOf(FirecrawlSearch::class);
+ expect($tools[2])->toBeInstanceOf(FirecrawlMap::class);
+ expect($tools[3])->toBeInstanceOf(FirecrawlCrawl::class);
+});
+
+it('passes an explicit client through to every tool', function (): void {
+ $client = fakeFirecrawlClient([
+ new Response(200, [], json_encode(['success' => true, 'data' => ['markdown' => '# Hi']])),
+ ]);
+
+ [$scrape] = FirecrawlTools::all($client);
+
+ // Uses the injected client (no container involved) — would throw otherwise.
+ expect($scrape->handle(new Request(['url' => 'https://example.com'])))->toBe('# Hi');
+});