Download the PHP package canvural/php-openapi-faker without Composer
On this page you can find all versions of the php package canvural/php-openapi-faker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download canvural/php-openapi-faker
More information about canvural/php-openapi-faker
Files in canvural/php-openapi-faker
Package php-openapi-faker
Short Description Library to generate fake data for OpenAPI request/response/schemas.
License MIT
Informations about the package php-openapi-faker
php-openapi-faker
Library to generate fake data for your OpenAPI requests, responses and schemas.
Installation
You can install the package via composer:
Usage
First you need to create an instance of OpenAPIFaker
with your schema that you want to fake data from. You can use createFromJson
, createFromYaml
or createFromSchema
to create an instance of OpenAPIFaker
.
Then you can use mockResponse
, mockResponseForExample
, mockRequest
, mockRequestForExample
, mockComponentSchema
and mockComponentSchemaForExample
methods on it to generate fake data for your requests, responses and schemas. Like so:
Options
There are some options you can use to modify some behaviour. You can pass options as an associative array to setOptions
method in OpenAPIFaker
. For example:
Below you can find explanation for each option.
minItems
Overrides minItems
property if it's less than this value.
maxItems
Override maxItems
if it's greater than this value.
alwaysFakeOptionals
If enabled, every property or item will be generated regardless if they are required or not. Default: false
strategy
By default, OpenAPIFaker
uses a dynamic generation strategy. You can enable the static examples generation by using the static
strategy.
Default: dynamic
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
People:
- Can Vural
- All Contributors
Resources:
License
The MIT License (MIT). Please see License File for more information.
All versions of php-openapi-faker with dependencies
ext-json Version *
cebe/php-openapi Version ^1.7
fakerphp/faker Version ^1.20
league/openapi-psr7-validator Version ^0.18
thecodingmachine/safe Version ^2.4