PHPackages                             yuubit/paxb - 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. yuubit/paxb

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

yuubit/paxb
===========

Public library PAXB - PHP Annotation Xml Binding, basic implementation of annotation driven xml binding

1.0.0(7y ago)0645↓100%MITPHP

Since Jan 1Pushed 7y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (6)Used By (0)

PAXB
====

[](#paxb)

PAXB - very basic implementation of annotation driven xml binding

Supported annotations
---------------------

[](#supported-annotations)

This lib supports listed bellow annotations:

- XmlAttribute(name="")
- XmlElement(name="", type="") - type is required for unmarshaling fields containing objects
- XmlElementWrapper(name) - name required
- XmlTransient
- XmlValue

These annotations could be used only as property annotations or class annotation(XmlElement only)

Sample code

Marshalling example
-------------------

[](#marshalling-example)

```
    /**
     * @XmlElement(name="root")
     */
    class SampleEntity {

        /**
         * @XmlElement(name="attribute-value", type="AttributeValueEntity")
         */
        private $nestedEntity;

        private $text;

        /**
         * @XmlElementWrapper(name="number-list")
         */
        private $number = array();

        public function __construct($number = array(), $nestedEntity = null, $text = "")
        {
            $this->number = $number;
            $this->nestedEntity = $nestedEntity;
            $this->text = $text;
        }
    }

    class AttributeValueEntity {

        /**
         * @XmlAttribute
         */
        private $attribute;

        /**
         * @XmlElement
         */
        private $value;

        /**
         * @param string $attribute
         * @param string $value
         */
        public function __construct($attribute = "", $value = "")
        {
            $this->attribute = $attribute;
            $this->value = $value;
        }

        /**
         * @return string
         */
        public function getAttribute()
        {
            return $this->attribute;
        }

        /**
         * @return string
         */
        public function getValue()
        {
            return $this->value;
        }
    }

```

Marshalling code:

```
    $sampleEntity = new SampleEntity(
        array(1,2,3),
        new AttributeValueEntity('sample attribure', 'sample value'),
        'Sample text'
    );

    echo PAXB\Setup::getMarshaller()->marshall($sampleEntity, true);

```

Output:

```

            sample value

        Sample text

            1
            2
            3

```

Unmarshalling example
---------------------

[](#unmarshalling-example)

```
    $xmlInput = '...'; //as above
    /** @var SampleEntity $sampleEntity */
    $sampleEntity = PAXB\Setup::getUnmarshaller()->unmarshall($xmlInput, 'SampleEntity');

```

Running examples
----------------

[](#running-examples)

1. Install composer: php -r "eval('?&gt;'.file\_get\_contents(''));"
2. Install dependencies: ./composer.phar install
3. run demo script: php demo/demo-marshall.php or php demo/demo-unmarshall.php

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~6 days

Total

4

Last Release

2659d ago

### Community

Maintainers

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

---

Top Contributors

[![ziollek](https://avatars.githubusercontent.com/u/4157902?v=4)](https://github.com/ziollek "ziollek (10 commits)")

---

Tags

xmlbindingmarshalling

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yuubit-paxb/health.svg)

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M228](/packages/masterminds-html5)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k135.8M851](/packages/jms-serializer)[jms/metadata

Class/method/property metadata management in PHP

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

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M626](/packages/jms-serializer-bundle)[sabre/xml

sabre/xml is an XML library that you may not hate.

52832.2M131](/packages/sabre-xml)[presta/sitemap-bundle

A Symfony bundle that provides tools to build your application sitemap.

3929.4M28](/packages/presta-sitemap-bundle)

PHPackages © 2026

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