{"id":16816519,"url":"https://github.com/canvural/php-openapi-faker","last_synced_at":"2025-04-06T13:10:29.201Z","repository":{"id":37822331,"uuid":"271818243","full_name":"canvural/php-openapi-faker","owner":"canvural","description":"Library to generate fake data for OpenAPI request/response/schemas","archived":false,"fork":false,"pushed_at":"2023-10-25T04:19:28.000Z","size":187,"stargazers_count":93,"open_issues_count":2,"forks_count":2,"subscribers_count":4,"default_branch":"2.1.x","last_synced_at":"2025-03-30T11:09:29.910Z","etag":null,"topics":["faker","mockdata","openapi","openapi3","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/canvural.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"canvural","custom":"https://www.paypal.me/canvural"}},"created_at":"2020-06-12T14:31:49.000Z","updated_at":"2024-12-09T16:22:45.000Z","dependencies_parsed_at":"2024-10-26T21:14:09.638Z","dependency_job_id":"65b79e1a-1b50-42e1-81b7-299e1efa1248","html_url":"https://github.com/canvural/php-openapi-faker","commit_stats":{"total_commits":139,"total_committers":6,"mean_commits":"23.166666666666668","dds":0.5827338129496402,"last_synced_commit":"efebc18aa855a9f2ae27789971d1e6701b3fbb8c"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canvural%2Fphp-openapi-faker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canvural%2Fphp-openapi-faker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canvural%2Fphp-openapi-faker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/canvural%2Fphp-openapi-faker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/canvural","download_url":"https://codeload.github.com/canvural/php-openapi-faker/tar.gz/refs/heads/2.1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247485287,"owners_count":20946398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["faker","mockdata","openapi","openapi3","php"],"created_at":"2024-10-13T10:44:38.483Z","updated_at":"2025-04-06T13:10:29.165Z","avatar_url":"https://github.com/canvural.png","language":"PHP","readme":"# php-openapi-faker\n\n![Tests](https://github.com/canvural/php-openapi-faker/workflows/Tests/badge.svg)\n[![codecov](https://codecov.io/gh/canvural/php-openapi-faker/branch/master/graph/badge.svg)](https://codecov.io/gh/canvural/php-openapi-faker)\n[![Infection MSI](https://badge.stryker-mutator.io/github.com/canvural/php-openapi-faker/master)](https://infection.github.io)\n[![PHPStan](https://img.shields.io/badge/PHPStan-Level%20Max-brightgreen.svg?style=flat\u0026logo=php)](https://phpstan.org)\n\nLibrary to generate fake data for your OpenAPI requests, responses and schemas.\n\n```php\n$faker = \\Vural\\OpenAPIFaker\\OpenAPIFaker::createFromJson($yourSchemaAsJson);\n$fakeData = $faker-\u003emockResponse('/todos','GET');\n```\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require --dev canvural/php-openapi-faker\n```\n\n## Usage\n\nFirst 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`.\n```php\n$faker = \\Vural\\OpenAPIFaker\\OpenAPIFaker::createFromJson($yourSchemaAsJson);\n```\n\nThen 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:\n\n```php\n$fakeData = $faker-\u003emockResponse('/todos','GET');\n```\n\n### Options\n\nThere 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:\n\n```php\n$faker = \\Vural\\OpenAPIFaker\\OpenAPIFaker::createFromJson($yourSchemaAsJson)\n    -\u003esetOptions(['minItems' =\u003e 5]);\n```\n\nBelow you can find explanation for each option.\n\n#### `minItems`\nOverrides `minItems` property if it's less than this value.\n\n#### `maxItems`\nOverride `maxItems` if it's greater than this value.\n\n### `alwaysFakeOptionals`\n\nIf enabled, every property or item will be generated regardless if they are required or not. **Default**: `false`\n\n### `strategy`\nBy default, `OpenAPIFaker` uses a dynamic generation strategy. You can enable the static examples generation by using the `static` strategy.\n**Default**: `dynamic`\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Credits\n\nPeople:\n- [Can Vural](https://github.com/canvural)\n- [All Contributors](../../contributors)\n\nResources:\n- [cebe/php-openapi](https://github.com/cebe/php-openapi)\n- [league/openapi-psr7-validator](https://github.com/thephpleague/openapi-psr7-validator)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":["https://github.com/sponsors/canvural","https://www.paypal.me/canvural"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanvural%2Fphp-openapi-faker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcanvural%2Fphp-openapi-faker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcanvural%2Fphp-openapi-faker/lists"}