Download the PHP package baudev/php-object-converter-bundle without Composer
On this page you can find all versions of the php package baudev/php-object-converter-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download baudev/php-object-converter-bundle
More information about baudev/php-object-converter-bundle
Files in baudev/php-object-converter-bundle
Package php-object-converter-bundle
Short Description This Symfony bundle converts PHP objects into ones of different languages
License MIT
Informations about the package php-object-converter-bundle
PHPObjectConverterBundle
This Symfony bundle converts PHP objects into ones of different languages.
Installation
Download the Bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Enable the Bundle
- If you're using Flex:
The bundle is automatically enabled :tada:
- If you're not using Flex:
You must add the bundle to your kernel:
How to use this Bundle?
Use the following command to convert your PHP classes:
The command parameters are the following ones:
| Parameter | Details |
|---|---|
| converter (required) | Name of a converter. E.g. typescript. See available converters. |
| source (required) | The directory containing classes to scan. |
| output (optional) | The output directory for generated classes. |
Available Converters
| Name | Converter file |
|---|---|
typescript |
Entity/converters/TypeScriptConverter.php |
| More soon! | ... |
You can create your own converter as explained here.
Demo
This example uses the typescript converter. It is the result of the follwing command bin/console converter:generate typescript src build.
Input class:
Output class:
Settings
Create file config/packages/php_object_converter.yaml and define:
-
If
enable_annotationistrue, then only classes with the annotation@Converterwill be converted. - If
disable_annotationistrue, then classes with@ConverterIgnorewill be ignored.
TODO
- [ ] Write tests.
- [ ] Support interfaces and methods conversion.
- [ ] Add more converters.