GithubHelp home page GithubHelp logo

faker-chinese-lorem's Introduction

Faker Chinese Lorem

Faker is a PHP library that generates fake data for you. See fzaninotto/Faker.

Faker Chinese Lorem let you generate Lorem in Chinese.

Build Status

Installation

composer require ganlvtech/faker-chinese-lorem

Basic Usage

Use Faker\Factory::create() to create and initialize a faker generator, and then use `.

<?php
// require the Faker autoloader
require_once '/path/to/Faker/src/autoload.php';
// alternatively, use another PSR-0 compliant autoloader (like the Symfony2 ClassLoader for instance)

// use the factory to create a Faker\Generator instance
$faker = Faker\Factory::create('zh_CN');

// add Faker Chinese Lorem provider
$faker->addProvider(new FakerChineseLorem\Provider\zh_CN\Lorem($faker));

// generate data by accessing properties
$faker->word;
  // '的'
  // '的一'
  // '的一是'
  // '的一是在'

Formatters

Faker\Provider\zh_CN\Lorem

<?php

// Generate a random single Chinese character
echo $faker->char; // '的'

// Generate an array of random characters
echo $faker->chars; // array('的', '一', '是')

// Generate a random word
// A chinese word usually contains 1 - 4 single character.
// Character numbers : Frequency
//                 1 : 10%
//                 2 : 60%
//                 3 : 10%
//                 4 : 20%
echo $faker->word; // '的' // '的一' // '的一是' // '的一是在'
// Generate a word that contians exact number of characters
echo $faker->word(2); // '的一' // '是在'

// Other functions
echo $faker->sentence; // sentence always end with a Chinese period (。).
echo $faker->sentences;
echo $faker->paragraph;
echo $faker->paragraphs;
echo $faker->text
echo $faker->text(100); // text contains no more than 100 Chinese characters (not 100 bytes)

License

Faker Chinese Lorem is released under the MIT Licence. See the bundled LICENSE file for details.

faker-chinese-lorem's People

Contributors

drjermy avatar ganlvtech avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.