承接 smknstd/fakerphp-picsum-images 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

smknstd/fakerphp-picsum-images

最新稳定版本:v1.0.3

Composer 安装命令:

composer require smknstd/fakerphp-picsum-images

包简介

Alternative image provider for fakerphp using picsum.photos

README 文档

README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Introduction

Alternative image provider for fakerphp using picsum.photos

This package has been forked from mmo/faker-images for fzaninotto/faker (deprecated ~ Oct 2020).

Ressources

Installation

You can install the package via composer in dev dependency section:

composer require --dev smknstd/fakerphp-picsum-images

Usage

$faker = \Faker\Factory::create();
$faker->addProvider(new \Smknstd\FakerPicsumImages\FakerPicsumImagesProvider($faker));

// return a string that contains a url like 'https://picsum.photos/800/600/'
$faker->imageUrl(width: 800, height: 600); 

// return a string that contains a url which returns the same random image based on the provided seed
$filePath= $faker->image(width: 800, height: 800, seed: 'useremail@example.com');

// download a properly sized image from picsum into a file with a file path like '/tmp/13b73edae8443990be1aa8f1a483bc27.jpg'
$filePath= $faker->image(dir: '/tmp', width: 640, height: 480);

Also, there are some more options :

  • alternative webp format
  • effects (grayscale, blurry)
  • seeding ensures you can get the same photo each time by providing a seed string
  • returning a specific photo based on an id instead of a random one (ex: https://picsum.photos/id/1/800/600)

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 189.87k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 45
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 45
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-10