PHPackages                             baudev/php-object-converter-bundle - 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. baudev/php-object-converter-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

baudev/php-object-converter-bundle
==================================

This Symfony bundle converts PHP objects into ones of different languages

v1.0.0(7y ago)05MITPHPPHP &gt;=7.1

Since Apr 8Pushed 7y ago1 watchersCompare

[ Source](https://github.com/baudev/PHPObjectConverterBundle)[ Packagist](https://packagist.org/packages/baudev/php-object-converter-bundle)[ RSS](/packages/baudev-php-object-converter-bundle/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

PHPObjectConverterBundle
========================

[](#phpobjectconverterbundle)

[![GitHub release](https://camo.githubusercontent.com/e5009c06e2d033e514ca0bd2d8d5861486ed4b2c3b2bd4c15964c45603057049/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6261756465762f5048504f626a656374436f6e76657274657242756e646c652e737667)](https://github.com/baudev/PHPObjectConverterBundle/releases)![PHP MINIMUM VERSION](https://camo.githubusercontent.com/67df4e608eede0be0d0809c53975bdfc98b1634eb7b447937703435f329148be/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f64796e616d69632f6a736f6e2e7376673f75726c3d68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6261756465762f5048504f626a656374436f6e76657274657242756e646c652f6d61737465722f636f6d706f7365722e6a736f6e266c6162656c3d5048502671756572793d242e726571756972652e706870)[![LICENSE](https://camo.githubusercontent.com/850eae1099d2b05f53383473d7cd51f9bc1ab09b7d0d9e5122f1dd930efdcc6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667)](https://camo.githubusercontent.com/850eae1099d2b05f53383473d7cd51f9bc1ab09b7d0d9e5122f1dd930efdcc6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667)

This Symfony bundle converts PHP objects into ones of different languages.

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

[](#installation)

### Download the Bundle

[](#download-the-bundle)

```
composer require baudev/php-object-converter-bundle

```

*This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md)of the Composer documentation.*

### Enable the Bundle

[](#enable-the-bundle)

- If you're using Flex:

The bundle is automatically enabled 🎉

- If you're not using Flex:

You must add the bundle to your kernel:

```
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Baudev\PHPObjectConverterBundle\PHPObjectConverterBundle(),
        ];

        // ...
    }

    // ...
}
```

How to use this Bundle?
-----------------------

[](#how-to-use-this-bundle)

Use the following command to convert your PHP classes:

```
bin/console converter:generate converter source [output]

```

The command parameters are the following ones:

ParameterDetailsconverter **(required)**Name of a converter. E.g. `typescript`. [See available converters.](#available-converters)source **(required)**The directory containing classes to scan.output *(optional)*The output directory for generated classes.### Available Converters

[](#available-converters)

NameConverter file`typescript``Entity/converters/TypeScriptConverter.php`More soon!...You can create your own converter as explained [here](https://github.com/baudev/PHPObjectConverterBundle/wiki/Create-a-Converter).

Demo
----

[](#demo)

This example uses the `typescript` converter. It is the result of the follwing command `bin/console converter:generate typescript src build`.

Input class:

```
// src/Entity/Person.php
class Person extends \App\Kernel
{
    /**
     * @var iterable
     */
    public static $firstName;
    /**
     * @var string
     */
    protected $lastName;
    /**
     * @var int
     */
    private $age;
}
```

Output class:

```
// build/Person.ts
class Person extends Kernel
{

    public static firstName:any;

    protected lastName:string;

    private age:number;

}
```

Settings
--------

[](#settings)

Create file `config/packages/php_object_converter.yaml` and define:

```
php_object_converter:
    enable_annotation: true # Enables @Converter annotation. See below.
    ignore_annotation: true # Enables @ConverterIgnore. See below.
    attributes:
        add_private: true # Converts private attributes. Ignore them if false.
        add_protected: true # Converts protected attributes. Ignore them if false.
```

- If `enable_annotation` is `true`, then only classes with the annotation `@Converter` will be converted.
- If `disable_annotation` is `true`, then classes with `@ConverterIgnore` will be ignored.

TODO
----

[](#todo)

- Write tests.
- Support interfaces and methods conversion.
- Add more converters.

Credits
-------

[](#credits)

- [PHP Parser](https://github.com/nikic/php-parser)
- [TypeScriptGeneratorBundle](https://github.com/janit/TypeScriptGeneratorBundle)

LICENSE
-------

[](#license)

```
MIT License

Copyright (c) 2019 Baudev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Unknown

Total

1

Last Release

2595d ago

### Community

Maintainers

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

---

Top Contributors

[![baudev](https://avatars.githubusercontent.com/u/29781702?v=4)](https://github.com/baudev "baudev (12 commits)")

---

Tags

converterslanguagesphp

### Embed Badge

![Health badge](/badges/baudev-php-object-converter-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/baudev-php-object-converter-bundle/health.svg)](https://phpackages.com/packages/baudev-php-object-converter-bundle)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[roave/backward-compatibility-check

Tool to compare two revisions of a public API to check for BC breaks

5953.3M56](/packages/roave-backward-compatibility-check)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[recca0120/laravel-erd

Laravel ERD automatically generates Entity-Relationship Diagrams from your Laravel models and displays them using Vuerd.

36072.0k](/packages/recca0120-laravel-erd)[ondrejmirtes/better-reflection

Better Reflection - an improved code reflection API

136.2M4](/packages/ondrejmirtes-better-reflection)

PHPackages © 2026

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