PHPackages                             igorw/edn - 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. igorw/edn

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

igorw/edn
=========

Extensible Data Notation Parser.

4211.3k3[3 issues](https://github.com/igorw/edn/issues)PHP

Since Jan 8Pushed 12y ago4 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Extensible Data Notation
========================

[](#extensible-data-notation)

Parser for the [edn](https://github.com/edn-format/edn) format. In PHP.

The parser internally relies on [Phlexy](https://github.com/nikic/Phlexy) for lexing.

Usage
-----

[](#usage)

### Parsing

[](#parsing)

To parse edn, just use the `parse` function:

```
$edn = file_get_contents('examples/sample.edn');
$data = igorw\edn\parse($edn);

print_r($data);

```

You can also define custom tag handlers and pass them as a second argument to `parse`:

```
use igorw\edn;

class Person {
    public $firstName;
    public $lastName;

    function __construct($firstName, $lastName) {
        $this->firstName = $firstName;
        $this->lastName = $lastName;
    }
}

$edn = '#myapp/Person {:first "Fred" :last "Mertz"}';

$data = edn\parse($edn, [
    'myapp/Person' => function ($node) {
        return new Person(
            $node[edn\keyword('first')],
            $node[edn\keyword('last')]
        );
    },
]);

// [new Person('Fred', 'Mertz')]

```

### Encoding

[](#encoding)

If you want to take an in-memory data structure and encode it as edn, you can use the `encode` function:

```
use igorw\edn;

$person = new edn\Map();
$person[edn\keyword('name')] = 'igorw';

$list = new edn\LinkedList([
    edn\symbol('foo'),
    edn\symbol('bar'),
    edn\symbol('baz'),
    edn\keyword('qux'),
    1.0,
    $person,
]);

$edn = edn\encode([$list]);
// (foo bar baz :qux 1.0 {:name "igorw"})

```

Tests
-----

[](#tests)

This library runs against the [shaunxcode/edn-tests](https://github.com/shaunxcode/edn-tests) suite.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3afcc18d00fff840775bbf9570b3e9cd3997ca4820b9bfb14caf6da3ae580370?d=identicon)[igorw](/maintainers/igorw)

---

Top Contributors

[![igorw](https://avatars.githubusercontent.com/u/88061?v=4)](https://github.com/igorw "igorw (94 commits)")

### Embed Badge

![Health badge](/badges/igorw-edn/health.svg)

```
[![Health](https://phpackages.com/badges/igorw-edn/health.svg)](https://phpackages.com/packages/igorw-edn)
```

###  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.0M282](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

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

Parser for CSS Files written in PHP

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

PHP Markdown

3.5k52.4M343](/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)
