Download the PHP package ybelenko/openapi-data-mocker without Composer

On this page you can find all versions of the php package ybelenko/openapi-data-mocker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package openapi-data-mocker

Openapi Data Mocker

Latest Stable Version Build Status Coverage Status License

Openapi Data Mocker helps to generate fake data from OpenAPI 3.0 documents. Most of the methods may work with 2.0 version(fka Swagger 2.0), but it's not tested. This package was an enhancement of PHP Slim4 server in OpenAPI Generator project, but it easier to maintain it in separated repo.

Requirements

Important notice! While PHP 8.0 declared in composer.json this package hasn't been tested against it.

Installation via Composer

Run in terminal:

Usage example

Imagine we have OpenAPI Specification 3.0.3 - Schema Object like this:

Notice! While schema object presented in YAML format this library doesn't support YAML or JSON parsing right now. It means that mockSchemaObject method expects already decoded JSON value as argument.

When we mock mentioned schema with mockSchemaObject method:

the output looks like:

Of course that output will be slightly different on every call. That's what mocker package has been developed for.

You can check extended example at examples/extended_example.php.

Supported features

All data types supported except specific string formats: email, uuid, password which are poorly implemented.

Data Types Support

Data Type Data Format Supported
integer int32 :white_check_mark:
integer int64 :white_check_mark:
number float :white_check_mark:
number double
string byte :white_check_mark:
string binary :white_check_mark:
boolean :white_check_mark:
string date :white_check_mark:
string date-time :white_check_mark:
string password :white_check_mark:
string email :white_check_mark:
string uuid :white_check_mark:

Data Options Support

Data Type Option Supported
string minLength :white_check_mark:
string maxLength :white_check_mark:
string enum :white_check_mark:
string pattern
integer minimum :white_check_mark:
integer maximum :white_check_mark:
integer exclusiveMinimum :white_check_mark:
integer exclusiveMaximum :white_check_mark:
number minimum :white_check_mark:
number maximum :white_check_mark:
number exclusiveMinimum :white_check_mark:
number exclusiveMaximum :white_check_mark:
array items :white_check_mark:
array additionalItems
array minItems :white_check_mark:
array maxItems :white_check_mark:
array uniqueItems
object properties :white_check_mark:
object maxProperties
object minProperties
object patternProperties
object additionalProperties
object required
* $ref :white_check_mark:
* allOf
* anyOf
* oneOf
* not

Known Limitations

Avoid circular refs in your schema. Schema below can cause infinite loop and Out of Memory PHP error:

Don't ref scalar types, because generator will not produce models which mock server can find. So schema below will cause error:

Links to mentioned technologies


All versions of openapi-data-mocker with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3 || ^8.0
ybelenko/openapi-data-mocker-interfaces Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ybelenko/openapi-data-mocker contains the following files

Loading the files please wait ....