PHPackages                             david-solus/reo-openimmo - 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. david-solus/reo-openimmo

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

david-solus/reo-openimmo
========================

Reordered properties

v0.11.17(4y ago)02.2kGPL-3.0PHPPHP &gt;=7.4

Since Feb 5Pushed 4y agoCompare

[ Source](https://github.com/david-solus/openimmo)[ Packagist](https://packagist.org/packages/david-solus/reo-openimmo)[ RSS](/packages/david-solus-reo-openimmo/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (2)Versions (37)Used By (0)

OpenImmo PHP library
====================

[](#openimmo-php-library)

[![Packagist](https://camo.githubusercontent.com/38802e99e44d99415d6ece8788c7e6399f3cb9752e1a43fc3f1221322665c256/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f756a616d69692f6f70656e696d6d6f2e7376673f636f6c6f72423d677265656e267374796c653d666c6174)](https://packagist.org/packages/ujamii/openimmo)[![Minimum PHP Version](https://camo.githubusercontent.com/b242943534f265f71a50445ff4307228bbc8b4e30d8f6094e3843ca8220eda23/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e332532422d3838393242462e7376673f7374796c653d666c6174)](https://php.net/)

OpenImmo and the OpenImmo logo are registered trademarks of the [OpenImmo e.V.](http://www.openimmo.de)Neither is this package an official distribution nor am I associated with this organisation!

This library just wraps the OpenImmo XML format with some PHP7/8 classes.

There is an official library available at  which costs 95 EUR excl. VAT and is PHP5 only. To completely convince you, you will only be allowed to see the code **after** you have paid and they have a no-refund policy.

**Important note**

This lib is a fork of umajiis project. The properties where reordered in this one.

I am not allowed to include real world xml examples into this distribution package due to license restrictions. Thus, some tests are automatically skipped, if the xml files are not found in the examples directory! Do not be fooled by "Open" in OpenImmo ;-)

Usage
-----

[](#usage)

### Writing OpenImmo XML

[](#writing-openimmo-xml)

```
// just create the elements you need in your xml and use the set-methods to fill in values.
$nutzungsart = new Nutzungsart();
$nutzungsart
    ->setWohnen(true)
    ->setGewerbe(false)
    ->setAnlage(false)
    ->setWaz(false);

$serializer = \JMS\Serializer\SerializerBuilder::create()->build();
echo $serializer->serialize($nutzungsart, 'xml');
```

will produce

```

```

Nested elements are created just as easy. Classes, properties, constants and parameters are named as corresponding items in the xsd file. They are just converted to camelCase to comply with PHP standards.

```
$infrastrktur = new Infrastruktur();
$infrastrktur
    ->setZulieferung(false)
    ->setAusblick((new Ausblick())->setBlick(Ausblick::BLICK_BERGE))
    ->setDistanzenSport([
        new DistanzenSport(DistanzenSport::DISTANZ_ZU_SPORT_SEE, 15)
    ])
    ->setDistanzen([
        new Distanzen(Distanzen::DISTANZ_ZU_HAUPTSCHULE, 22)
    ]);

$serializer = \JMS\Serializer\SerializerBuilder::create()->build();
echo $serializer->serialize($infrastrktur, 'xml');
```

will generate

```

	22.0
	15.0
	false

```

### Reading OpenImmo XML

[](#reading-openimmo-xml)

Reading data from xml into a easy-to-use object structure is also pretty straightforward. This example will generate a list of objects (addresses).

```
$xmlString = file_get_contents('./example/foobar.xml');
/* @var $openImmo \Ujamii\OpenImmo\API\Openimmo */
$openImmo = $serializer->deserialize($xmlString, \Ujamii\OpenImmo\API\Openimmo::class, 'xml');

/* @var $anbieter \Ujamii\OpenImmo\API\Anbieter */
foreach ($openImmo->getAnbieter() as $anbieter) {
    /* @var $immobilie \Ujamii\OpenImmo\API\Immobilie */
    foreach ($anbieter->getImmobilie() as $immobilie) {
        echo PHP_EOL . vsprintf('%s %s, %s %s', [
                $immobilie->getGeo()->getStrasse(),
                $immobilie->getGeo()->getHausnummer(),
                $immobilie->getGeo()->getPlz(),
                $immobilie->getGeo()->getOrt(),
            ]);
    }
}
```

### Writing JSON (since v0.10)

[](#writing-json-since-v010)

Although the OpenImmo standard just describes an XML version, there may be cases when you want to generate JSON from the given data. Sadly, there is [an issue](https://github.com/schmittjoh/serializer/issues/1251) with custom types, scalar values and JSON serialization in the JMS serializer. Nevertheless it is still possible to write JSON format with the [Symfony serializer component](https://symfony.com/doc/current/components/serializer.html).

```
composer require symfony/serializer
```

Generating JSON then works like this:

```
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
use Symfony\Component\Serializer\Normalizer\DateTimeNormalizer;
use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
use Symfony\Component\Serializer\Serializer;

$openImmoObject = null; // this may be any object of one of the API classes from this package
$encoders    = [new JsonEncoder()];
$normalizers = [
    new DateTimeNormalizer(),
    new GetSetMethodNormalizer()
];
$serializerContext = [
    AbstractObjectNormalizer::SKIP_NULL_VALUES       => true,
    AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS => false,
    'json_encode_options'                            => \JSON_PRESERVE_ZERO_FRACTION
];

$serializer = new Serializer($normalizers, $encoders);
$jsonContent = $this->serializer->serialize($openImmoObject, JsonEncoder::FORMAT, $serializerContext);
```

### Possible issues

[](#possible-issues)

#### DateTime format not working

[](#datetime-format-not-working)

Some tools may generate DateTime values in the xml, which cause errors like

```
Fatal error: Uncaught JMS\Serializer\Exception\RuntimeException: Invalid datetime "2020-08-07T11:56:39.1242974+02:00", expected one of the format "Y-m-d\TH:i:sP", "Y-m-d\TH:i:s".

```

This can be caused by a different precision for the microsecond part (1242974) of this value. As the default PHP precision may be lower that the one of the tool, which the xml was generated with. If this problem occurs with the data you use, you can add a handler, included in this package, to the serializer like this:

```
use JMS\Serializer\Handler\HandlerRegistryInterface;
use Ujamii\OpenImmo\Handler\DateTimeHandler;

$builder = \JMS\Serializer\SerializerBuilder::create();
$builder
    ->configureHandlers(function(HandlerRegistryInterface $registry) {
        $registry->registerSubscribingHandler(new DateTimeHandler());
    })
;
$serializer = $builder->build();
```

### Update API classes with a new OpenImmo version

[](#update-api-classes-with-a-new-openimmo-version)

1. Install composer package.
2. Download OpenImmo files from [their website](http://www.openimmo.de/go.php/p/24/download.htm) (extract into the example folder). Their license agreement denies redistribution of the xsd file.
3. `php -f generate-api.php` will fill the `src/API` directory with new classes.
4. `composer dumpautoload` to update the autoloading.
5. Done.

### Running tests

[](#running-tests)

1. `composer run phpunit`

License and Contribution
------------------------

[](#license-and-contribution)

[GPLv3](LICENSE)

As this is OpenSource, you are very welcome to contribute by reporting bugs, improve the code, write tests or whatever you are able to do to improve the project.

If you want to do me a favour, buy me something from my [Amazon wishlist](https://www.amazon.de/registry/wishlist/2C7LSRMLEAD4F).

### Thank you!

[](#thank-you)

- [Qbus Internetagentur GmbH](https://www.qbus.de/) for your code contribution

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 77.2% 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 ~35 days

Recently: every ~0 days

Total

34

Last Release

1558d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e281811b74895364970bab99c87ac245867a3f4c1796b1b427028618aa8ce74?d=identicon)[david-solus](/maintainers/david-solus)

---

Top Contributors

[![mgrundkoetter](https://avatars.githubusercontent.com/u/1526725?v=4)](https://github.com/mgrundkoetter "mgrundkoetter (200 commits)")[![david-marquardt](https://avatars.githubusercontent.com/u/64682508?v=4)](https://github.com/david-marquardt "david-marquardt (23 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![bnf](https://avatars.githubusercontent.com/u/473155?v=4)](https://github.com/bnf "bnf (14 commits)")[![andypost](https://avatars.githubusercontent.com/u/73713?v=4)](https://github.com/andypost "andypost (1 commits)")

### Embed Badge

![Health badge](/badges/david-solus-reo-openimmo/health.svg)

```
[![Health](https://phpackages.com/badges/david-solus-reo-openimmo/health.svg)](https://phpackages.com/packages/david-solus-reo-openimmo)
```

###  Alternatives

[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[farmos/farmos

A web-based farm record keeping application.

1.3k7.1k1](/packages/farmos-farmos)[symplify/vendor-patches

Generate vendor patches for packages with single command

1927.5M40](/packages/symplify-vendor-patches)[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

40252.8k34](/packages/ec-europa-toolkit)[dagger/dagger

Dagger PHP SDK

261.1k](/packages/dagger-dagger)[vardot/varbase-project

Project template for Varbase distribution.

5162.5k](/packages/vardot-varbase-project)

PHPackages © 2026

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