PHPackages                             prewk/xml-faker - 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. prewk/xml-faker

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

prewk/xml-faker
===============

Create random XML with the help of fzaniotto/Faker.

0.1.1(6y ago)101.8k[2 issues](https://github.com/prewk/xml-faker/issues)2MITPHPPHP &gt;=5.3.0

Since Apr 27Pushed 6y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (12)Used By (2)

xml-faker [![Build Status](https://camo.githubusercontent.com/e6854ce2f3fc79471a0e8e63e02425aae3f8ba432a452f50205c7497cfd4c7d3/68747470733a2f2f7472617669732d63692e6f72672f707265776b2f786d6c2d66616b65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/prewk/xml-faker)
======================================================================================================================================================================================================================================================================================

[](#xml-faker-)

Create fake XML with the help of [fzaninotto/Faker](https://github.com/fzaninotto/Faker)

Why?
----

[](#why)

Useful for testing stuff.

Usage
-----

[](#usage)

Supply the constructor with a valid `SimpleXMLElement` and use the methods to generate XML in the sizes that you wish.

Your supplied XML will be used as a blueprint for creating the random XML. If an attribute as an integer, random integers will be created for those attributes. If your node text consists of a text with linebreaks, a random text with the same amount of linebreaks will be created for those nodes.

Only the first node encountered will be used like this, the rest of your supplied XML will be ignored.

Installation
------------

[](#installation)

composer.json:

```
"require": {
    "prewk/xml-faker": "*"
}

```

Example
-------

[](#example)

Create an example.xml:

```

    OneWord
    123

        This is some
        text on some
        lines

```

Load it:

```
$myXmlBlueprint = simplexml_load_file("example.xml");
$xmlFaker = new Prewk\XmlFaker($myXmlBlueprint);

```

Create an XML string with 100 nodes:

```
echo $xmlFaker->asString(Prewk\XmlFaker::NODE_COUNT_RESTRICTION_MODE, 100);

```

Create an XML string of maximum 1 MB (1024 \* 1024 chars):

```
echo $xmlFaker->asString(Prewk\XmlFaker::BYTE_COUNT_RESTRICTION_MODE, 1024 * 1024);

```

More useful, stream an XML file of 100 MB to disk (will take a while):

```
$xmlFaker->asFile("my-new-large-xml-file.xml", Prewk\XmlFaker::BYTE_COUNT_RESTRICTION_MODE, 100 * 1024 * 1024);

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

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

Every ~216 days

Recently: every ~541 days

Total

11

Last Release

2232d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8f3625261e7ace9c6248835418795f4b7f181df06edf191dc26b6ee8c19c3c1d?d=identicon)[prewk](/maintainers/prewk)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/prewk-xml-faker/health.svg)

```
[![Health](https://phpackages.com/badges/prewk-xml-faker/health.svg)](https://phpackages.com/packages/prewk-xml-faker)
```

###  Alternatives

[bheller/images-generator

Generator of placeholder images for Faker

573.1M3](/packages/bheller-images-generator)[digilist/snakedumper

5045.5k](/packages/digilist-snakedumper)[swekaj/cron-expression-generator

Generate valid cron expressions.

1069.1k1](/packages/swekaj-cron-expression-generator)[hydreflab/jedi-faker

Faker extension for Star Wars junkie

1429.5k1](/packages/hydreflab-jedi-faker)[andrefigueira/blog-article-faker

Generate random blog article titles and content (including markdown) using faker

1415.0k](/packages/andrefigueira-blog-article-faker)[gourmet/faker

Faker support for CakePHP 3

189.3k1](/packages/gourmet-faker)

PHPackages © 2026

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