PHPackages                             georgeh/php-beerxml - 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. georgeh/php-beerxml

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

georgeh/php-beerxml
===================

BeerXML parser and generator

1.0.0(13y ago)116381MITPHPPHP &gt;=5.3.0

Since May 16Pushed 12y ago3 watchersCompare

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

READMEChangelogDependencies (2)Versions (2)Used By (0)

php-beerxml
===========

[](#php-beerxml)

[![Build Status](https://camo.githubusercontent.com/ee67e89a8f7331d22c0a95bc5f57ad391d97857745974684548511f138d85942/68747470733a2f2f7472617669732d63692e6f72672f67656f726765682f7068702d62656572786d6c2e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/georgeh/php-beerxml)[![Coverage Status](https://camo.githubusercontent.com/0f96478f1d40926ce86d243f9e5840d26be3255d9d23be321e6f4988025280db/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f67656f726765682f7068702d62656572786d6c2f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/georgeh/php-beerxml)

A PHP parser and generator for the [BeerXML 1.0](http://www.beerxml.com/) standard.

Usage
=====

[](#usage)

Full API documentation is at

The unit tests in the tests/ directory provides some good examples as well.

Parser
------

[](#parser)

```
$parser = new \BeerXML\Parser();
$result = $parser->parse(file_get_contents('http://www.beerxml.com/recipes.xml'));
foreach ($result as $recipe) {
    /** @var $recipe \BeerXML\Record\Recipe **/
    echo "Found beer recipe " . $recipe->getName() . "\n";
}
```

If you don't want to use the basic record classes from the `BeerXML\Record` namespace (say, you want to add some ABV math or some Doctrine annotations so your recipe can easily save to a database) it's possible to specify the classes that get generated. You'll need to implement the `BeerXML\Parser\I*Writer` interfaces in your classes, then subclass `BeerXML\Parser\RecordFactory` to have it create your classes. Once you've got your objects set up, you can pass it into the constructor of `BeerXML\Parser`

Generator
---------

[](#generator)

```
$recipe = new \BeerXML\Record\Recipe();
$recipe->setName('My Brew');

$generator = new \BeerXML\Generator();
$generator->addRecord($recipe);
$xml = $generator->render();
echo $xml;
```

`BeerXML\Generator` will accept any record that implements the `BeerXML\Generator\I*Reader` interfaces.

Records
-------

[](#records)

There are a record classes for all the record types in the BeerXML specification that contain getter and setter methods. They implement the extended "Display" interfaces for the parser and generator, which means that include getters and setters from Appendix A of the spec. They do not include any math or compute any fields, as that is outside the scope of this project.

```
$recipe = new \BeerXML\Record\Recipe();
$recipe->setName('Imperial Session');
$recipe->setOg(1.105);
$recipe->setFg(1.002);
$recipe->setIbu(99);
```

Installation
============

[](#installation)

Requires **PHP 5.3.0** or higher.

The easiest way is to install php-beerxml with [Composer](http://getcomposer.org/doc/00-intro.md).

Create a file named `composer.json` in your project root:

```
{
    "require": {
        "georgeh/php-beerxml": "*",
    }
}
```

Then, run the following commands:

```
$ curl -s http://getcomposer.org/installer | php
$ php composer.phar install
```

If you don't use Composer, you can directly [download](https://github.com/georgeh/php-beerxml) the sources and configure it with your PSR-0 compatible autoloader.

License
=======

[](#license)

This software is free to use under the MIT license, but if you are happy with it I wouldn't mind one of your homebrews.

Copyright (c) 2013 George Hotelling

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

[![Devtroit](https://camo.githubusercontent.com/6afbabed3c3efbd24b8bd7dee8199898295ad70f7bd0607b31467db205f68385/687474703a2f2f64657674726f69742e636f6d2f696d672f6261646765732f62616467652d6d656469756d2e706e67)](https://camo.githubusercontent.com/6afbabed3c3efbd24b8bd7dee8199898295ad70f7bd0607b31467db205f68385/687474703a2f2f64657674726f69742e636f6d2f696d672f6261646765732f62616467652d6d656469756d2e706e67)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

4747d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d5dd0067aa748d9648f44813a03eaeebc1a153764693749a4add2e82e308535?d=identicon)[georgeh](/maintainers/georgeh)

---

Top Contributors

[![georgeh](https://avatars.githubusercontent.com/u/128240?v=4)](https://github.com/georgeh "georgeh (37 commits)")

---

Tags

beerhomebrewbeerxmlhomebrewing

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/georgeh-php-beerxml/health.svg)

```
[![Health](https://phpackages.com/badges/georgeh-php-beerxml/health.svg)](https://phpackages.com/packages/georgeh-php-beerxml)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

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