emanueleminotto / faker-placehold-it-provider
Faker 的 placehold.it 提供器
1.0.0
2015-01-30 21:43 UTC
Requires
- fzaninotto/faker: ~1
Requires (Dev)
- phpunit/phpunit: ~4.4
This package is auto-updated.
Last update: 2024-08-28 06:19:35 UTC
README
placehold.it 为 Faker 提供器。
API: emanueleminotto.github.io/PlaceholdItProvider
安装
使用 Composer 安装 Silex。
添加 emanueleminotto/faker-placehold-it-provider
到您的 composer.json 或从 CLI 安装 PlaceholdItProvider
$ composer require emanueleminotto/faker-placehold-it-provider
使用方法
$faker = Faker\Factory::create(); $faker->addProvider(new EmanueleMinotto\Faker\PlaceholdItProvider($faker)); // size $url = $faker->imageUrl(50); // http://placehold.it/50.gif $url = $faker->imageUrl('50x100'); // http://placehold.it/50x100.gif $url = $faker->imageUrl(array(50, 100)); // http://placehold.it/50x100.gif $url = $faker->imageUrl(array('w' => 100, 'h' => 50)); // http://placehold.it/50x100.gif // format // can be gif, jpeg, jpg or png $url = $faker->imageUrl(50); // http://placehold.it/50.gif $url = $faker->imageUrl(50, 'jpeg'); // http://placehold.it/50.jpeg $url = $faker->imageUrl(50, 'jpg'); // http://placehold.it/50.jpg $url = $faker->imageUrl(50, 'png'); // http://placehold.it/50.png // colors $url = $faker->imageUrl(50, null, array('000', 'fff')); // http://placehold.it/50.gif/000/fff $url = $faker->imageUrl(50, null, array('w' => 100, 'h' => 100)); // http://placehold.it/50.gif/000/fff // text $url = $faker->imageUrl(50, null, array(), 'lorem ipsum'); // http://placehold.it/50.gif?text=lorem+ipsum