daavelar / faker-json
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/daavelar/faker-json
Requires
- ext-json: *
- fakerphp/faker: ^1.23
- illuminate/support: ^10.0.0
Requires (Dev)
- phpunit/phpunit: ^11.2
README
Faker Json is a library in PHP that uses the Faker library to generate valid JSONs from templates with variables.
The idea is to replace variables in the format ${variable}
or method(arguments)
with values generated by the Faker library.
Installation
composer require daavelar/faker-json
Usage
use Faker\Factory; use FakerJson\FakerJson; $fakerJson = new FakerJson($faker); $template = '{ "name": "firstName", "email": "email", "phone": "phoneNumber", "age": "numberBetween(18, 65)" "company": { "name": "companyName", "address": "streetAddress", "bs": "buildingNumber" } }'; $json = $fakerJson->generate($template); echo $json;
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.