Skip to content

nicodemuz/api-platform-yaml-to-attributes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Platform YAML converter

This script converts your API Platform V2 YAML configuration files to API Platform V3 compatible configurations using PHP attributes.

Installation

You can simply clone this repository and run the script. This script does not have to be part of your project files.

git clone https://github.com/nicodemuz/api-platform-yaml-to-attributes.git;
cd api-platform-yaml-to-attributes;
composer install;

Sample usage

<?php

use Nicodemuz\ApiPlatformYamlToAttributes\Runner;

require 'vendor/autoload.php';

$runner = new Runner(
    yamlApiPlatformDir: '/path/to/symfony/config/api_platform',
    yamlSerializerDir: '/path/to/symfony/config/serializer',
    doctrineEntityDir: '/path/to/symfony/src/Entity',
);
$runner->convertSerializerConfigurations()->convertApiPlatformConfigurations();

Notes

This script was hacked together in a few hours. Use at own risk. Commit your work before executing.

The script does not support all API Platform V3 configuration parameters. If a configuration parameter is unsupported, no changes will be executed. Please modify Runner.php file accordingly. Pull requests will be gladly accepted.

The script uses Nette PHP Code Generator to rewrite your PHP files. It will likely introduce some unwanted changes. You may wish to modify the printer code in Runner.php to match your coding standard.

Authors

About

Converts your API Platform V2 YAML configuration files to API Platform V3 compatible configurations using PHP attributes.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages