canvural/php-openapi-faker

Library to generate fake data for OpenAPI request/response/schemas.

0.1.1 2020-07-22 12:14 UTC

This package is auto-updated.

Last update: 2020-08-06 07:26:40 UTC


README

Tests codecov Infection MSI PHPStan

Library to generate fake data for your OpenAPI requests, responses and schemas.

$faker = \Vural\OpenAPIFaker\OpenAPIFaker::createFromJson($yourSchemaAsJson);
$fakeData = $faker->mockResponse('/todos','GET');

Installation

You can install the package via composer:

composer require --dev canvural/php-openapi-faker

Usage

First you need to create an instance of OpenAPIFaker with your schema that you want to fake data from.

$faker = \Vural\OpenAPIFaker\OpenAPIFaker::createFromJson($yourSchemaAsJson);

Then you can use mockResponse, mockRequest and mockSchema methods on it to generate fake data for your requests, responses and schemas. Like so:

$fakeData = $faker->mockResponse('/todos','GET');

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

People:

Resources:

License

The MIT License (MIT). Please see License File for more information.