hydreflab / jedi-faker
Star Wars 爱好者的 Faker 扩展
v1.4.0
2018-02-03 20:09 UTC
Requires
- php: >=7.0
- fzaninotto/faker: ~1.4
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is not auto-updated.
Last update: 2024-09-29 05:31:15 UTC
README
Faker 扩展,适用于 Star Wars 爱好者。
安装
composer require hydreflab/jedi-faker`
基本用法
您可以使用本包提供的数据以两种方式使用:
- 使用
HydrefLab\JediFaker\Factory
, - 或手动将提供者添加到
Faker\Factory
.
// use provided factory to create generator with already registered providers $faker = HydrefLab\JediFaker\Factory::create(); // or use Faker factory and manually register new providers $faker = Faker\Factory::create(); $faker->addProvider(new HydrefLab\JediFaker\Provider\Character($faker)); ... // add other providers $faker->darkSide; // Darth Vader $faker->quote; // No. I am your father. $faker->quote('han_solo'); // Never tell me the odds! $faker->droid; // R2-D2 $faker->episode; // Episode VIII: The Last Jedi ...
提供者
每个提供者包含一个或多个格式化器。目前只支持默认区域设置(en_US)。
HydrefLab\JediFaker\Provider\Character
$faker->lightSide; // Yoda
$faker->darkSide; // Kylo Ren
$faker->character; // Han Solo
$faker->quote; // Now, young Skywalker, you will die.
$faker->quote('leia'); // Aren't you a little short for a storm trooper?
要获取可用角色的引用列表,请检查提供者文件。
HydrefLab\JediFaker\Provider\Droid
$faker->droid; // C-3PO
HydrefLab\JediFaker\Provider\Movie
$faker->episode; // Episode V: The Empire Strikes Back
$faker->episode(2); // Episode II: Attack of the Clones
$faker->episodeOpeningCrawl; // Turmoil has engulfed the\r\nGalactic Republic. The taxation\r\nof trade routes to outlying star\r\nsystems is in dispute.\r\n\r\nHoping to resolve the matter\r\nwith a blockade of deadly\r\nbattleships, the greedy Trade\r\nFederation has stopped all\r\nshipping to the small planet\r\nof Naboo.\r\n\r\nWhile the Congress of the\r\nRepublic endlessly debates\r\nthis alarming chain of events,\r\nthe Supreme Chancellor has\r\nsecretly dispatched two Jedi\r\nKnights, the guardians of\r\npeace and justice in the\r\ngalaxy, to settle the conflict....
$faker->episodeOpeningCrawl(4); // It is a period of civil war.\r\nRebel spaceships, striking\r\nfrom a hidden base, have won\r\ntheir first victory against\r\nthe evil Galactic Empire.\r\n\r\nDuring the battle, Rebel\r\nspies managed to steal secret\r\nplans to the Empire's\r\nultimate weapon, the DEATH\r\nSTAR, an armored space\r\nstation with enough power\r\nto destroy an entire planet.\r\n\r\nPursued by the Empire's\r\nsinister agents, Princess\r\nLeia races home aboard her\r\nstarship, custodian of the\r\nstolen plans that can save her\r\npeople and restore\r\nfreedom to the galaxy....
HydrefLab\JediFaker\Provider\Planet
$faker->planet; // Tatooine
HydrefLab\JediFaker\Provider\Species
$faker->species; // Wookiee
HydrefLab\JediFaker\Provider\Vehicle
$faker->vehicle; // Millennium Falcon
HydrefLab\JediFaker\Provider\Squadron
$faker->squadron; // Green
$faker->squadronName; // Blue Squadron
$faker->pilot; // Red Leader or Blue #7
$faker->pilotRank; // Pilot
贡献
欢迎贡献!请阅读 CONTRIBUTING 获取详细信息。
版权和许可
包根据 MIT 许可证(MIT)授权使用。有关更多信息,请参阅 LICENSE。