Download the PHP package paysera/util-raml-code-generator without Composer
On this page you can find all versions of the php package paysera/util-raml-code-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download paysera/util-raml-code-generator
More information about paysera/util-raml-code-generator
Files in paysera/util-raml-code-generator
Package util-raml-code-generator
Short Description Generate Code from RAML specification
License proprietary
Informations about the package util-raml-code-generator
util-raml-code-generator
util-raml-code-generator
generates code packages from specified RAML definition.
Currently this utility can:
- Automatically generate and release:
PHP REST API client
Javascript REST API client
- Generate
Symfony Api Bundle
Requirements
PHP 7.2
Composer <= 2.2.9
, higher versions not yet supported, work in progress
Installation
- Clone repository and run
composer install
Table of contents
- RAML structure
- api.raml
- types/category.raml
- types/category-result.raml
- traits/category-filter.raml
- Custom annotations
(generator_method_name_override)
- Generate and publish clients
- config.json format
- Generate Javascript REST client
- File tree
- src/entity/Category.js
- src/entity/CategoryFilter.js
- src/entity/CategoryResult.js
- src/service/createClient.js
- src/service/CategoryClient.js
- Generate PHP REST client
- File tree
- src/CategoryClient.php
- src/ClientFactory.php
- src/Entity/Category.php
- src/Entity/CategoryFilter.php
- src/Entity/CategoryResult.php
- Generate Symfony Bundle
RAML structure
Lets have following RAML
structure:
With following contents:
raml/category/api.raml
raml/category/types/category.raml
raml/category/traits/category-filter.raml
raml/category/types/category-result.raml
Custom annotations
(generator_method_name_override)
Use this to override method name (for any generated client or bundle).
For example:
Generate and publish clients
- Run
bin/console release:clients {path_to_config}
.path_to_config
path toconfig.json
file.
This command will
- clone repository
- generate clients from
raml
- update changelog
- show you the difference between current and generated files
- generate dist files for javascript
- create a commit
- push commit
- create tag
config.json format
Generate Javascript REST client
- Run
bin/console js-generator:package {path_to_raml} {output_dir} {client_name} --library_name={library_name}
.path_to_raml
path toraml
file.output_dir
directory where to put generated files.client_name
is the name of your main javascript client.library_name
is optional name for generated library, i.e.@paysera/some-api-client
- Check the dumped output to
{output_dir}
directory.
Javascript client file tree
In output_dir
you should expect these files generated:
With following contents of services and entities src
directory:
src/entity/Category.js
src/entity/CategoryFilter.js
src/entity/CategoryResult.js
src/service/createClient.js
src/service/CategoryClient.js
Generate PHP REST client
- Run
bin/console php-generator:rest-client {path_to_raml} {output_dir} {namespace} --library_name={library_name}
.path_to_raml
path toraml
file.output_dir
directory where to put generated files.namespace
is the namespace of Client.library_name
is optional name for generated library, i.e.paysera/lib-some-api-client
- Check the dumped output to
{output_dir}
directory.
PHP Client file tree
In output_dir
you should expect these files generated:
With following contents of src
directory:
src/CategoryClient.php
src/ClientFactory.php
src/Entity/Category.php
src/Entity/CategoryFilter.php
src/Entity/CategoryResult.php
Generate Symfony Bundle
- Run
bin/console php-generator:symfony-bundle {path_to_raml} {output_dir} {namespace}
.path_to_raml
path toraml
file.output_dir
directory where to put generated files.namespace
is the namespace of your Symfony Bundle.
- Check the dumped output to
{output_dir}
directory.
In output_dir
you should expect these files generated:
With following contents:
CategoryPermissions.php
VendorCategoryApiBundle.php
Controller/CategoryApiController.php
DependencyInjection/Configuration.php
DependencyInjection/VendorCategoryApiExtension.php
Entity/Category.php
Entity/CategoryFilter.php
Normalizer/CategoryNormalizer.php
Normalizer/CategoryFilterNormalizer.php
Repository/CategoryRepository.php
Service/CategoryManager.php
Voter/CategoryScopeVoter.php
All versions of util-raml-code-generator with dependencies
ext-sqlite3 Version *
doctrine/dbal Version ^2.7
doctrine/inflector Version ^1.1
fig/http-message-util Version ^1.0
incenteev/composer-parameter-handler Version ^2.0
padraic/phar-updater Version ^1.0
paysera/lib-changelog-parser Version ^1.1.2
paysera/lib-dependency-injection Version ^1.0
raml-org/raml-php-parser Version ^4.5
sebastian/diff Version ^2.0
sensio/distribution-bundle Version ^5.0.19
sensio/framework-extra-bundle Version ^5.1.6
symfony/monolog-bundle Version ^3.1.0
symfony/polyfill-apcu Version ^1.0
symfony/symfony Version ^3.4.35
twig/twig Version ^2.12