PHPackages                             sallyx/nette-xml-adapter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sallyx/nette-xml-adapter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sallyx/nette-xml-adapter
========================

XML adapter for Nette Dependency Injection Component

v2.0.0(6y ago)126MITPHPPHP &gt;=7.1.0

Since Jul 12Pushed 6y ago1 watchersCompare

[ Source](https://github.com/sallyx/nette-xml-adapter)[ Packagist](https://packagist.org/packages/sallyx/nette-xml-adapter)[ Docs](http://github.org/sallyx/nette-xml-adapter)[ RSS](/packages/sallyx-nette-xml-adapter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (8)Used By (0)

Xml Adapter
===========

[](#xml-adapter)

[![Build Status](https://camo.githubusercontent.com/50ad739ee81d009b186f633b4fac670dca2bccaccb47e42459bbb50169ddd76d/68747470733a2f2f7472617669732d63692e6f72672f73616c6c79782f6e657474652d786d6c2d616461707465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/sallyx/nette-xml-adapter)

XML adapter could be used to write configuration in XML. Thanks to namespace usage () you can have configuration common for your php application (nette) and other application in the same xml file.

XmlAdapter reads xml file and convert it to PHP array.

See xml example here: [tests/Adapters/files/xmlAdapter.xml](tests/Adapters/files/xmlAdapter.xml)

Supported types
---------------

[](#supported-types)

### Associative array

[](#associative-array)

```
value1value2
```

Becomes:

```
[key1 => 'value1', key2=>'value2']
```

### Numeric array

[](#numeric-array)

```
value1value2
```

Becomes (*element names are ignored here*):

```
[0=>'value1',1=>'value2]
```

### String, Null, Number, Boolean

[](#string-null-number-boolean)

```

 trimmed string
 string with spaces
1

```

Becomes:

```
["trimmed string", " string with spaces  ","1", 2, TRUE, NULL]
```

*Bool support "yes", "true", "on" and "1"*

### Statement

[](#statement)

```

    DateTime
   format%B

```

Is equivalent to neon: `DateTime(0)::format("%B")`

Syntactic sugar
---------------

[](#syntactic-sugar)

### Array from string

[](#array-from-string)

```
1,2,3
```

Becomes:

```
["1", "2", "3"]
```

#### The same with custom delimiter:

[](#the-same-with-custom-delimiter)

```
1;2;3
```

### Statement

[](#statement-1)

Of course you can use `array from string` as statement arguments.

```

fooo1;2;3

```

If there is only one argument, you dont need to use element inside args element. These statements are equivalent:

```
fooo1
fooo1
```

You can use neon syntax for statement:

```

```

\#Usage

Install with composer
---------------------

[](#install-with-composer)

```
composer require sallyx/nette-xml-adapter

```

Test
----

[](#test)

```
require 'vendor/autoload.php';
use Sallyx\Nette\DI\Config\Adapters\XmlAdapter;

$adapter = new XmlAdapter;
$file = 'vendor/sallyx/nette-xml-adapter/tests/Adapters/files/xmlAdapter.xml';
$config = $adapter->load($file);
print_r($config);
```

Usage with Nette
----------------

[](#usage-with-nette)

Add this line into your app/bootstrap.php after `$configurator = new Nette\Configurator;`

```
$xmlAdapter = new Sallyx\Nette\DI\Config\Adapters\XmlAdapter;
$configurator->addAdapter('xml', $xmlAdapter);

```

And now you can load XML configuration files (alongside with neon files). For example:

```
$configurator->addConfig(__DIR__ . '/config/config.xml', Nette\Config\Configurator::AUTO);

```

### How to convert neon config file to xml config file

[](#how-to-convert-neon-config-file-to-xml-config-file)

```
require __DIR__ . '/vendor/autoload.php';
use Nette\DI\Config\Adapters\NeonAdapter;
use Sallyx\Nette\DI\Config\Adapters\XmlAdapter;

$na = new NeonAdapter;
$xa = new XmlAdapter;
$config = $na->load('config.neon');
$xmlConfig = $xa->dump($config);
// pretty output
$domxml = new DOMDocument('1.0');
$domxml->preserveWhiteSpace = false;
$domxml->formatOutput = true;
$domxml->loadXML($xmlConfig);
echo $domxml->saveXML();
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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 ~287 days

Recently: every ~427 days

Total

7

Last Release

2240d ago

Major Versions

v0.3 → v1.0.02015-11-09

v1.0.2 → v2.0.02020-03-31

PHP version history (3 changes)v0.1PHP &gt;=5.4.4

v0.2PHP &gt;=5.3.0

v2.0.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/521447ca813bc89fb2ef2780a06a5acf931c474beedcbed786838372a55d292a?d=identicon)[sallyx](/maintainers/sallyx)

---

Top Contributors

[![sallyx](https://avatars.githubusercontent.com/u/4263901?v=4)](https://github.com/sallyx "sallyx (15 commits)")

### Embed Badge

![Health badge](/badges/sallyx-nette-xml-adapter/health.svg)

```
[![Health](https://phpackages.com/badges/sallyx-nette-xml-adapter/health.svg)](https://phpackages.com/packages/sallyx-nette-xml-adapter)
```

###  Alternatives

[bileto/cronner

Simple tool which helps with maintenance of cron tasks.

752.1k](/packages/bileto-cronner)

PHPackages © 2026

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