Coder Social home page Coder Social logo

spinzar / faker-japanese Goto Github PK

View Code? Open in Web Editor NEW

This project forked from keidarcy/faker-japanese

0.0 1.0 0.0 33 KB

🚀Faker Japanese ⛩ is a Faker provider that generates fake Japanese 🎎🏯 related data for you.

Home Page: https://packagist.org/packages/xyyolab/faker-japanese

License: MIT License

PHP 100.00%

faker-japanese's Introduction

faker-japanese

English | 日本語

Build Status

Japanese related random data generate using fzaninotto/Faker.

  • You don't need specify like Faker\Factory::create('ja_JP')
  • I implement all logic with my provider.

Installation

To install, use composer:

composer require xyyo/faker-japanese

Usage

Basic usage anywhere

<?php
// psr-4 autoload class
require_once 'vendor/autoload.php';

$faker = Faker\Factory::create();

$faker->addProvider(new Faker\Provider\Japanese($faker));

// text related
$faker->color => 薄橙
$faker->kanji => 悠
$faker->word => 給料
$faker->idiom => 画竜点睛
$faker->pokemon => スリーパー
$faker->realText => 大きな望遠鏡ぼうえんきょうで銀河ぎんがをよっく調しらべると銀河ぎんがはだいたい何でしょう。

// internet related
$faker->domainName => saito.org
$faker->url => www.hiroshi.com
$faker->email => [email protected]
$faker->userFirstName => osamu
$faker->userLastName => yamada
$faker->userName => yamaguchi chiyo

// address related
$faker->bank => 北九州銀行
$faker->postcode => 869-5565
$faker->country => 合衆国領有小離島
$faker->prefecture => 三重県
$faker->ward => 西区
$faker->city => 松本市
$faker->streetAddress => 西之園町3-7-3
$faker->secondaryAddress => 吉田コーポ104$faker->address => 佐賀県山口市南区中村町4-5-9
$faker->addressWithCode => 304-6851  奈良県田中市南区佐藤町5-4-3 若松ハイツ105// person related
$faker->phone => 00332-8-0234
$faker->company => 有限会社佐々木木材
$faker->lastName => 渡辺
$faker->firstName('male') => 太一
$faker->firstName('female') => 明美
$faker->name('male') => 松本 涼平
$faker->name('female') => 村山 春香
$faker->lastKanaName => ツダ
$faker->firstKanaName('male') => ヨウスケ
$faker->firstKanaName('female') => モモコ
$faker->kanaName('male') => ナカジマ ミツル
$faker->kanaName('female') => ナカムラ ハルカ

Laravel usage

// UserFactory.php
$factory->define(User::class, function (Faker $faker) {
    // add this simple line here
    $faker->addProvider(new \Faker\Provider\Japanese($faker));
    return [
        'name' => $faker->name,
        'email' => $faker->unique()->safeEmail,
.....
We can check the difference in tinker !
Psy Shell v0.9.12 (PHP 7.3.13 — cli) by Justin Hileman
>>> factory(App\User::class,2)->create()
=> Illuminate\Database\Eloquent\Collection {#3330
     all: [
       App\User {#3326
         name: "宮沢 直人",
         email: "[email protected]",
         email_verified_at: "2020-02-17 12:21:38",
         updated_at: "2020-02-17 12:21:38",
         created_at: "2020-02-17 12:21:38",
         id: 5,
       },
       App\User {#3335
         name: "大垣 智也",
         email: "[email protected]",
         email_verified_at: "2020-02-17 12:21:38",
         updated_at: "2020-02-17 12:21:38",
         created_at: "2020-02-17 12:21:38",
         id: 7,
       },
     ],
   }

to do

  • send pr to orginal package.

License

Faker Japanese is released under the MIT License. See the bundled LICENSE file for details.

LICENSE

Reporting an issue or a feature request

Fork it, send a PR. Issues and feature requests are tracked in the GitHub issue tracker.

faker-japanese's People

Contributors

keidarcy avatar

Watchers

 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.