PHP code example of gheb / api-platform-config-converter-bundle

1. Go to this page and download the library: Download gheb/api-platform-config-converter-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gheb / api-platform-config-converter-bundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = [
        // ...
    ];

    if (in_array($this->getEnvironment(), ['dev'])) {
        //...
        $bundles[] = new ConfigurationConverter\ConfigurationConverterBundle();
    }

    return $bundles;
}


// config/bundles.php



return [
    // ...
    ConfigurationConverter\ConfigurationConverterBundle::class => ['dev' => true],
];
shell
$ php bin/console configuration:convert -r 'FQCN\Of\Your\Entity' --api-platform-output
$ php bin/console configuration:convert -r 'FQCN\Of\Your\Entity' --api-platform-output 'custom/directory'

$ php bin/console configuration:convert -r 'FQCN\Of\Your\Entity' --serializer-groups-output
$ php bin/console configuration:convert -r 'FQCN\Of\Your\Entity' --serializer-groups-output 'custom/directory'

$ php bin/console configuration:convert -r 'FQCN\Of\Your\Entity' --serializer-groups-output --api-platform-output
$ php bin/console configuration:convert -r 'FQCN\Of\Your\Entity' --api-platform-output 'custom/directory' --serializer-groups-output 'custom/directory'