定制 recycledbeans/the-office-faker 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

recycledbeans/the-office-faker

Composer 安装命令:

composer require recycledbeans/the-office-faker

包简介

Faker Generator themed around one of the best TV shows ever, The Office.

README 文档

README

Latest Stable Version Build Status

Bears. Beets. Battlestar Galactica.

With this package, you can extend the extremely useful Faker (fzaninotto/faker) Library to seed your PHP application with fake data using characters and companies from the hit TV series, The Office (US).

This is vital for when we launch Dunder Mifflin Infinity ✌️-point-👌!

Installation

Install this package using Composer.

composer require recycledbeans/the-office-faker

Usage

Start using characters and company names immediately using the Faker methods you are already familiar with by adding the provider to your Faker instance.

The example below is using a Laravel Factory as an example, but Faker (and this provider) can be used in any PHP project.

$faker = Faker\Factory::create();
$faker->addProvider(new \TheOfficeFaker\Provider\TheOffice($faker));

// Example usage (more details below)
$name = $faker->character()->name; // Dwight Schrute
$company = $faker->company; // Poor Richard's Pub

🔥 Laravel

If you are using this package in a Laravel application, you can also make this functionality available to all of your factories and tests globally by adding the TheOfficeFaker\Laravel\TheOfficeServiceProvider::class to the providers section of config/app.php as detailed in the Laravel Docs.

Characters

The default usage above creates truly randomized first and last names, so you will end up with names like "Roy Kapoor" or "Jim Schrute". If you would like the have the first and last names be consistent with the characters on the show (which is probably what most people would enjoy), you can use the character() method to return an object of a character's details.

$character = $faker->character();

return [
    'given_name' => $character->firstName,
    'family_name' => $character->lastName,
    'email' => $character->safeEmail,
];

Companies

There is a small, but growing, list of fictional (and some Scranton-area) company names taken from episodes of The Office. You can use these the same way you would use the normal company attribute.

// Michael Scott Paper Company, for instance
$company = $faker->company; 

Contributing

Running unit tests

This project uses PHPUnit. You can run tests with or without code coverage.

With no code coverage

./vendor/bin/phpunit

With code coverage (you must have Xdebug installed to run code coverage)

./vendor/bin/phpunit --coverage-html tests/coverage

To view the code coverage report open tests/coverage/index.html in your browser.

Ideas

Do you have ideas for other bits of data that you would like to see in this package? Create an issue with your suggestion!

TODO (I would love your help!)

There is a short list of things I would like to improve or add in the near future to make this provider even better. If you would like to help in this endeavor, please feel free to create a pull request. Even if you don't feel like coding, if you see someone major that is missing from the characters list or a company that hasn't been added, please create a PR!

  • Add more company names: there are plenty of references to fictional companies and Scranton-area places that could be added for even more variability.
  • Cities and localities: I don't know if there will be enough cities mentioned in the office (mostly from the PA area), but I think it's worth looking into whether the provider can provide enough cities to have them added.
  • Lines from the episodes? Maybe a text provider that returns a random sentence from an actual line of dialog?

Follow me on Twitter!

统计信息

  • 总下载量: 896
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固