Skip to content

Commit

Permalink
Merge pull request #11 from aalaap/fakerphp-sunrise
Browse files Browse the repository at this point in the history
Upgrade package to work with the new Faker
  • Loading branch information
aalaap authored Nov 7, 2020
2 parents d551a84 + 3d9f102 commit 11ab47f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
YouTube Provider for Faker
---

This package will allow [Faker](https://github.com/fzaninotto/Faker) to generate
This package will allow [Faker](https://github.com/FakerPHP/Faker) to generate
fake, but technically valid, YouTube URLs in various formats as well as an embed
HTML.

Expand All @@ -11,6 +11,18 @@ is also really low, but not impossible.

[![Build Status](https://travis-ci.org/aalaap/faker-youtube.svg?branch=master)](https://travis-ci.org/aalaap/faker-youtube)

## Upgrading to the new Faker?

Since the [original Faker](https://github.com/fzaninotto/Faker) was [sunsetted](https://marmelab.com/blog/2020/10/21/sunsetting-faker.html),
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:
Expand All @@ -22,24 +34,27 @@ composer require aalaap/faker-youtube
## Use

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

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

```
$faker->youtubeUri()
echo $faker->youtubeUri();
// https://www.youtube.com/watch?v=KyXYWQ-B3zO
$faker->youtubeShortUri()
echo $faker->youtubeShortUri();
// https://youtu.be/watch?v=rsPyiZSzj3g
$faker->youtubeEmbedUri()
echo $faker->youtubeEmbedUri();
// https://www.youtube.com/embed/aUgKvcNS6en
$faker->youtubeEmbedCode()
echo $faker->youtubeEmbedCode();
// <iframe width="560" height="315" src="https://www.youtube.com/embed/aUgKvcNS6en" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe>
$faker->youtubeRandomUri()
echo $faker->youtubeRandomUri();
// https://youtu.be/watch?v=lctkDb05MKT
```

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
],
"keywords": ["faker", "provider", "youtube"],
"require": {
"php": "^5.6 || ^7.0",
"fzaninotto/faker": "^1.7"
"php": "^7.1 || ^8.0",
"fakerphp/faker": "^1.10"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
"phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.4.2"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 11ab47f

Please sign in to comment.