定制 aalaap/faker-youtube 二次开发

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

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

aalaap/faker-youtube

最新稳定版本:2.0.3

Composer 安装命令:

composer require aalaap/faker-youtube

包简介

Faker provider for generating fake YouTube video URLs

README 文档

README

This package will allow Faker to generate fake, but technically valid, YouTube URLs in various formats as well as an embed HTML.

YouTube's hashing algorithm ensures that the possibility of collisions is really low, so the chances of a random URI generated by this packge being a real video is also really low, but not impossible.

Build Status

Upgrading to the new Faker?

Since the original Faker was sunsetted, this package was updated to 2.0 to work with the new Faker, bringing along updated version requirements, which now apply to this package as well.

  • php: ^7.1 || ^8.0
  • phpunit/phpunit: ^7.5.20 || ^8.5.8 || ^9.4.2

If you are still using the original Faker, you can continue to use versions 1.x of this package.

Install

To install, use composer:

composer require aalaap/faker-youtube

Use

# When installed via composer
require_once 'vendor/autoload.php';

$faker = \Faker\Factory::create();
$faker->addProvider(new \Faker\Provider\Youtube($faker));
echo $faker->youtubeUri();
// https://www.youtube.com/watch?v=KyXYWQ-B3zO

echo $faker->youtubeShortUri();
// https://youtu.be/watch?v=rsPyiZSzj3g

echo $faker->youtubeEmbedUri();
// https://www.youtube.com/embed/aUgKvcNS6en

echo $faker->youtubeEmbedCode();
// <iframe width="560" height="315" src="https://www.youtube.com/embed/aUgKvcNS6en" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>

echo $faker->youtubeRandomUri();
// https://youtu.be/watch?v=lctkDb05MKT

License

This package is under the WTFPL license. Do whatever you want with it.

LICENSE

Reporting an issue or a feature request

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

统计信息

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

GitHub 信息

  • Stars: 22
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: WTFPL
  • 更新时间: 2017-12-08