PHPackages                             ssnepenthe/recipe-scraper - 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. ssnepenthe/recipe-scraper

ActiveLibrary

ssnepenthe/recipe-scraper
=========================

A recipe scraping library.

0.4.4(5y ago)471.4k↓100%14[3 issues](https://github.com/ssnepenthe/recipe-scraper/issues)[2 PRs](https://github.com/ssnepenthe/recipe-scraper/pulls)GPL-2.0PHPPHP &gt;=7.0CI failing

Since Apr 11Pushed 2y ago4 watchersCompare

[ Source](https://github.com/ssnepenthe/recipe-scraper)[ Packagist](https://packagist.org/packages/ssnepenthe/recipe-scraper)[ Docs](https://github.com/ssnepenthe/recipe-scraper)[ RSS](/packages/ssnepenthe-recipe-scraper/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (5)Versions (10)Used By (0)

recipe-scraper
==============

[](#recipe-scraper)

A recipe scraping library which makes it easy to scrape recipes from popular sites around the web.

Current site support is still limited. A full list is available in [SITE-SUPPORT.md](SITE-SUPPORT.md).

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

[](#requirements)

Composer, PHP 7.0 or later.

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

[](#installation)

```
composer require ssnepenthe/recipe-scraper

```

Usage
-----

[](#usage)

Scraper instances work on Symfony DomCrawler instances. These can be created however you choose, but the easiest is to use a BrowserKit implementation like Goutte:

```
$client = new Goutte\Client;
$crawler = $client->request('GET', 'http://allrecipes.com/recipe/139917/joses-shrimp-ceviche/');
```

If you only need to scrape recipes from a single site, you can use the corresponding class from `src/Scrapers`:

```
$scraper = new RecipeScraper\Scrapers\AllRecipesCom;
```

If you want to be able to scrape recipes from all supported sites, create a `DelegatingScraper` using the `Factory` class:

```
$scraper = RecipeScraper\Factory::make();
```

Check whether a scraper supports a given crawler using the `->supports()` method:

```
$scraper->supports($crawler); // true
```

Finally, scrape a recipe by passing the crawler to the `->scrape()` method:

```
$recipe = $scraper->scrape($crawler);
```

The following properties are guaranteed to be set on the `$recipe` array:

```
$recipe['author'] // string|null
$recipe['categories'] // string[]|null
$recipe['cookingMethod'] // string|null
$recipe['cookTime'] // string|null
$recipe['cuisines'] // string[]|null
$recipe['description'] // string|null
$recipe['image'] // string|null
$recipe['ingredients'] // string[]|null
$recipe['instructions'] // string[]|null
$recipe['name'] // string|null
$recipe['notes'] // string[]|null
$recipe['prepTime'] // string|null
$recipe['publisher'] // string|null
$recipe['totalTime'] // string|null
$recipe['url'] // string|null
$recipe['yield'] // string|null
```

If the `->scrape()` method is called on an unsupported crawler instance, all values in `$recipe` will be null.

Altogether:

```
$scraper = RecipeScraper\Factory::make();
$client = new Goutte\Client;
$url = 'http://allrecipes.com/recipe/139917/joses-shrimp-ceviche/';
$crawler = $client->request('GET', $url);

if ($scraper->supports($crawler)) {
    var_dump($scraper->scrape($crawler));
} else {
    var_dump("{$url} not currently supported!");
}
```

OUTPUT:

```
array(15) {
    'author' => string(9) "carrielee"
    'categories' => array(2) {
        [0] => string(21) "Appetizers and Snacks"
        [1] => string(5) "Spicy"
    }
    'cookingMethod' => NULL
    'cookTime' => string(5) "PT10M"
    'cuisines' => NULL
    'description' => string(336) ""I've looked all over the net and haven't found a shrimp ceviche quite like this one! My friends absolutely love it and beg me for the recipe! You can always double it for larger parties--it goes FAST! Serve as a dip with tortilla chips or as a topping on a tostada spread with mayo. The fearless palate might like this with hot sauce.""
    'image' => string(66) "https://images.media-allrecipes.com/userphotos/560x315/1364063.jpg"
    'ingredients' => array(9) {
        [0] => string(41) "1 pound peeled and deveined medium shrimp"
        [1] => string(22) "1 cup fresh lime juice"
        [2] => string(23) "10 plum tomatoes, diced"
        [3] => string(27) "1 large yellow onion, diced"
        [4] => string(49) "1 jalapeno pepper, seeded and minced, or to taste"
        [5] => string(28) "2 avocados, diced (optional)"
        [6] => string(31) "2 ribs celery, diced (optional)"
        [7] => string(31) "chopped fresh cilantro to taste"
        [8] => string(24) "salt and pepper to taste"
    }
    'instructions' => array(2) {
        [0] => string(294) "Place shrimp in a glass bowl and cover with lime juice to marinate (or 'cook') for about 10 minutes, or until they turn pink and opaque. Meanwhile, place the plum tomatoes, onion and jalapeno (and avocados and celery, if using) in a large, non-reactive (stainless steel, glass or plastic) bowl."
        [1] => string(200) "Remove shrimp from lime juice, reserving juice. Dice shrimp and add to the bowl of vegetables. Pour in the remaining lime juice marinade. Add cilantro and salt and pepper to taste. Toss gently to mix."
    }
    'name' => string(21) "Jose's Shrimp Ceviche"
    'notes' => NULL
    'prepTime' => string(5) "PT45M"
    'publisher' => NULL
    'totalTime' => string(5) "PT55M"
    'url' => string(62) "https://www.allrecipes.com/recipe/139917/joses-shrimp-ceviche/"
    'yield' => string(2) "20"
}
```

Limitations
-----------

[](#limitations)

Scraping seems to be (unfortunately) the best option available for extracting structured recipes from the sites supported by this scraper.

Just keep in mind that any template updates to the target site have a very high chance of breaking this scraper.

If you notice support for a particular site is broken, please submit an issue or pull request.

For this same reason, it **may** be preferable to track the master branch of this repo, although I will try to tag a new release after any site-specific updates.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.1% 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 ~187 days

Recently: every ~237 days

Total

9

Last Release

2182d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.4

0.4.0PHP &gt;=7.0

### Community

Maintainers

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

---

Top Contributors

[![ssnepenthe](https://avatars.githubusercontent.com/u/10903810?v=4)](https://github.com/ssnepenthe "ssnepenthe (536 commits)")[![Mark-Howe](https://avatars.githubusercontent.com/u/1932792?v=4)](https://github.com/Mark-Howe "Mark-Howe (4 commits)")[![davidmuggleton](https://avatars.githubusercontent.com/u/15907082?v=4)](https://github.com/davidmuggleton "davidmuggleton (1 commits)")

### Embed Badge

![Health badge](/badges/ssnepenthe-recipe-scraper/health.svg)

```
[![Health](https://phpackages.com/badges/ssnepenthe-recipe-scraper/health.svg)](https://phpackages.com/packages/ssnepenthe-recipe-scraper)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[laravel/browser-kit-testing

Provides backwards compatibility for BrowserKit testing in the latest Laravel release.

5139.4M286](/packages/laravel-browser-kit-testing)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[drupal/core-dev

require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.

2021.0M277](/packages/drupal-core-dev)[spatie/laravel-visit

Quickly visit any route of your Laravel app

15614.6k](/packages/spatie-laravel-visit)

PHPackages © 2026

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