Skip to content

Coming From Crawl4AI

PAM Crawl is an independent PHP re-implementation inspired by Crawl4AI. If you know Crawl4AI, you already know most of PAM Crawl: the same concepts (fit Markdown, BM25 and pruning filters, deep-crawl strategies, JSON CSS schemas, URL seeding, adaptive crawling), the same CLI shape as crwl, and an HTTP API with the same port, endpoints and payloads.

The biggest difference is underneath. Crawl4AI opens a browser for every page by default. PAM Crawl speaks HTTP/2 directly and reaches for a browser only when a page truly needs JavaScript, through the optional PAM Crawl Browser plugin.

Crawl4AI PAM Crawl
AsyncWebCrawler().arun(url) Crawl::url($url)->get()
arun_many(urls, config) Crawl::urls($urls)->stream()
BFSDeepCrawlStrategy(max_depth, max_pages) Crawl::site($url)->depth(3)->limit(100)
BestFirstCrawlingStrategy(url_scorer=KeywordRelevanceScorer) ->prioritize(Score::keywords('a', 'b'))
URLPatternFilter / DomainFilter ->only('/docs/*') / ->filterUrls(Filter::domains([...]))
AsyncUrlSeeder / DomainMapper UrlSeeder::for($domain) / DomainMapper::for($domain)
AdaptiveConfig(strategy="embedding") new Adaptive\Config(strategy: 'embedding', ...)
CacheMode.ENABLED / BYPASS ->cache() / ->cacheMode(CacheMode::Bypass)
Crawl4AI PAM Crawl
result.markdown.raw_markdown / .fit_markdown $page->markdown->raw / $page->content->raw
BM25ContentFilter(user_query=q) $page->markdown(focus: $q) or ->filter(new Bm25Filter($q))
PruningContentFilter() ->filter(new PruningFilter())
css_selector / target_elements / excluded_tags ->selector() / ->target() / ->excludeTags()
Crawl4AI PAM Crawl
JsonCssExtractionStrategy(schema) Schema::fromArray($schema)->extract($page)
Pydantic model + LLMExtractionStrategy #[Css] / #[JsonLd] DTOs, or LlmExtraction
CosineStrategy(semantic_filter, linkage_method="ward") new CosineExtraction($embeddings, semanticFilter: ..., linkageMethod: 'ward')
get_text_embeddings(texts, llm_config) (new Llm\Embeddings($config))->embedMany($texts)
c4a_compile(script) / C4A_SCRIPT Script\C4a::compile($script) / ->script($c4a)
CrawlerHub.get("name") Hub::get('name')
Crawl4AI PAM Crawl
crwl URL -o markdown pam crawl URL -o markdown
crwl config list|get|set, crwl examples pam crawl config list|get|set, pam crawl examples
crwl browser start|stop|status|view|restart, crwl cdp The same commands (browser plugin)
crwl profiles create|list|delete, crwl shrink, crwl URL -p profile The same commands; pam crawl URL --profile NAME
Crawl4AI PAM Crawl
Docker server on :11235 (/playground, /dashboard) pam crawl serve or the Docker image, same port and endpoints
/mcp/sse, /mcp/messages/ The same endpoints, plus POST /mcp and pam crawl mcp (stdio); no /mcp/ws

The same task, fetching a page’s main content and crawling a docs section, in both libraries:

crawl4ai.py
from crawl4ai import AsyncWebCrawler, CrawlerRunConfig
from crawl4ai.deep_crawling import BFSDeepCrawlStrategy
async with AsyncWebCrawler() as crawler:
result = await crawler.arun("https://docs.example.com/")
print(result.markdown.fit_markdown)
config = CrawlerRunConfig(deep_crawl_strategy=BFSDeepCrawlStrategy(max_depth=2, max_pages=20))
for page in await crawler.arun("https://docs.example.com/", config=config):
print(page.url)
crawl.php
use Pam\Crawl\Crawl;
use Pam\Crawl\Page;
echo Crawl::url('https://docs.example.com/')->get()->content->raw;
Crawl::site('https://docs.example.com/')
->depth(2)->limit(20)
->each(fn (Page $p) => print($p->url."\n"));
  • No browser by default. JavaScript execution, screenshots, PDFs and C4A-Script need the PAM Crawl Browser plugin. Without it, the HTTP API ignores browser-only options such as js_code, wait_for and screenshot.
  • Many JavaScript pages work anyway. Client-rendered pages are flagged with $page->isShell, and their data is often available through $page->embedded (Next.js, Nuxt, Remix and other hydration data) or $page->api(). See JavaScript Pages.
  • Bring your own renderer. ->fallback(fn (string $url) => ...) hands blocked or failed pages to any renderer you run elsewhere, and ->render($renderer) accepts any implementation of Pam\Crawl\Render\Renderer.
  • Browser settings on the CLI. Of Crawl4AI’s BrowserConfig, only browser_mode=builtin, cdp_url, user_data_dir, headless and browser_type are honoured; the rest are accepted and ignored.
  • Immutable builders. Every method on a crawler returns a modified copy, so a configured crawler can be reused and shared safely.

PAM Crawl ports or adapts several algorithms from Crawl4AI: the pruning and BM25 content filters, image and link scoring, table detection, URL seeding, domain mapping, adaptive crawling, chunking, the JSON CSS/XPath extraction schema and the LLM prompts. Crawl4AI is Copyright 2024 UncleCode and licensed under the Apache License 2.0; PAM Crawl is also Apache-2.0 and carries the required notice in its NOTICE file.

PAM Crawl is not affiliated with, authorized by, maintained by, sponsored by, or endorsed by the Crawl4AI project or its authors.


This product includes software developed by UncleCode (https://x.com/unclecode) as part of the Crawl4AI project (https://github.com/unclecode/crawl4ai).