PHPackages                             karlomikus/recipe-utils - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. karlomikus/recipe-utils

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

karlomikus/recipe-utils
=======================

Utilities for extracting normalized ingredient data from recipes

0.17.0(8mo ago)54.5k—10%MITPHPPHP ^8.2CI passing

Since Aug 7Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/karlomikus/recipe-utils)[ Packagist](https://packagist.org/packages/karlomikus/recipe-utils)[ RSS](/packages/karlomikus-recipe-utils/feed)WikiDiscussions master Synced 1mo ago

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

Recipe Utilities
================

[](#recipe-utilities)

[![GitHub Actions Workflow Status](https://camo.githubusercontent.com/8e3f0cee9dd3daff2e1c4e56bb374246a7e528deb554ec15b70fe02d9c55c658/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b61726c6f6d696b75732f7265636970652d7574696c732f636f64652e796d6c)](https://camo.githubusercontent.com/8e3f0cee9dd3daff2e1c4e56bb374246a7e528deb554ec15b70fe02d9c55c658/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6b61726c6f6d696b75732f7265636970652d7574696c732f636f64652e796d6c)[![Packagist Version](https://camo.githubusercontent.com/cd572af2ee8ad54a14d7fee3d30f3ac45c32d2ec2e5b18af61bab5c219336e74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61726c6f6d696b75732f7265636970652d7574696c73)](https://camo.githubusercontent.com/cd572af2ee8ad54a14d7fee3d30f3ac45c32d2ec2e5b18af61bab5c219336e74/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b61726c6f6d696b75732f7265636970652d7574696c73)[![GitHub License](https://camo.githubusercontent.com/62c48288a89d32e41c327030da5e34e10df1285d1eb4cd59ec3cbc7b1e909c23/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6b61726c6f6d696b75732f7265636970652d7574696c73)](https://camo.githubusercontent.com/62c48288a89d32e41c327030da5e34e10df1285d1eb4cd59ec3cbc7b1e909c23/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6b61726c6f6d696b75732f7265636970652d7574696c73)

Utilities for extracting ingredient data from (mostly cocktail) recipes into structured objects.

Install
-------

[](#install)

Install via composer

```
$ composer require karlomikus/recipe-utils
```

Parser usage
------------

[](#parser-usage)

All parse methods return object of type `Kami\RecipeUtils\RecipeIngredient`.

Supported formats:

- Variable amounts and fractional amounts: "1 - 2", "0.5 to 1", "½ or 2 1/5"
- Comments are anything after comma or anything in brackets: "12 ml ingredient, preferebly something specific"
- Basic units mostly used in cocktails: ml, cl, oz, sprigs, dashes, etc...

```
