Skip to content

daavelar/faker-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Faker Json

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.

About

Transform your json in fake templates

Resources

License

Contributing

Stars

1 star

Watchers

1 watching

Forks

Packages

 
 
 

Contributors

Languages