PHPackages                             bradietilley/faker-imagez - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. bradietilley/faker-imagez

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bradietilley/faker-imagez
=========================

Base system for providing faker images

v1.1.0(2y ago)05232MITPHP

Since Apr 12Pushed 2y ago1 watchersCompare

[ Source](https://github.com/bradietilley/faker-imagez)[ Packagist](https://packagist.org/packages/bradietilley/faker-imagez)[ RSS](/packages/bradietilley-faker-imagez/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (2)

Images
======

[](#images)

[![Static Analysis](https://github.com/bradietilley/faker-imagez/actions/workflows/static.yml/badge.svg)](https://github.com/bradietilley/faker-imagez/actions/workflows/static.yml/badge.svg)[![Tests](https://github.com/bradietilley/faker-imagez/actions/workflows/tests.yml/badge.svg)](https://github.com/bradietilley/faker-imagez/actions/workflows/tests.yml/badge.svg)

Introduction
------------

[](#introduction)

FakerImagez provides an interface for other faker image generators.

Repositories
------------

[](#repositories)

[Imagez](https://github.com/bradietilley/faker-imagez) available:

- [Catz](https://github.com/bradietilley/faker-imagez)
- [Dogz](https://github.com/bradietilley/faker-dogz)
- [Foodz](https://github.com/bradietilley/faker-foodz)

Documentation
-------------

[](#documentation)

It's insanely easy to use.

Define your Imagez class, or use one of the above ^

```
class Something extends Imagez
{
    public static function basePath(): string
    {
        return '/path/to/images';
    }
}
```

If you're using a package mentioned above, just replace `imagez()` in the examples below with the name of the package, such as `foodz()` or `catz()`.

**Get random paths**

Each invocation will return a new random path.

```
imagez()->path();                             // string: /path/to/pics/image_0037.jpg
imagez()->path();                             // string: /path/to/pics/image_0101.jpg
```

Once all image images are exhausted, it'll refeed and continue again with another random order.

**Get random contents**

Each invocation will return a new random file's contents.

```
imagez()->contents();                         // string:
imagez()->contents();                         // string:
```

**Get SplFileInfo objects**

Each invocation will return a new random file as an instance of `SplFileInfo`.

```
imagez()->fileinfo();                         // \SplInfo:
imagez()->fileinfo();                         // \SplInfo:
```

**Get exact image**

Have a favorite? Get specific ones every time using the `get` method. This will *NOT* remove the image from the pool, it will simply fetch the given image.

```
imagez()->get(24);                            // string: /path/to/pics/image_0024.jpg
imagez()->get(43);                            // string: /path/to/pics/image_0043.jpg
```

**Get count of images**

If you'd like to determine the number of images available, use the `count` method. This will *NOT* count the pool but all images.

```
$min = 1;
$max = catz()->count();

$image = catz()->get(mt_rand($min, $max));  // string: /path/to/pics/image_XXXX.jpg
```

**Halt iterating for repeat interactions**

Sometimes you might want to iterate the pool manually and perform multiple queries to fetch the path, contents or splfile info without having it automatically iterate. You can achieve this using the below approach.

```
imagez()->iterate();                          // Iterates to the next image

imagez()->getCurrentImagePath();              // string: /path/to/pics/image_0046.jpeg                 (won't iterate)
imagez()->getCurrentImagePath();              // string: /path/to/pics/image_0046.jpeg                 (won't iterate)
imagez()->getCurrentImageContents();          // string:    (won't iterate)
imagez()->getCurrentImageFileinfo();          // \SplFileInfo: /path/to/pics/image_0046.jpeg           (won't iterate)
```

**Get all images**

Maybe you want to pluck all sample images and do something custom. Easy as. The `all` method will return all images (paths), the `pool` method will return what's remaining in the pool (paths).

```
imagez()->all();                              // array:

imagez()->path();                             // this iterates the pool, popping the last path from the pool
imagez()->pool();                             // array:          (pool contains one less now)

imagez()->path();                             // this iterates the pool, popping the last path from the pool
imagez()->pool();                             // array:                   (pool contains one less now)
```

**Pool reloading**

These are internal functions but they're also public. Might come in handy if you're doing something custom:

```
foreach (range(1, 100) as $i) {
    imagez()->path();                         // iterates 100 images
}

imagez()->loadWhenEmpty();                    // Won't do anything here as there's still images in the pool.
imagez()->load();                             // Will reload the pool of images to be the full collection of image images.
```

**Replace all images in the faker**

You can also replace all images in the faker using the `replaceAll()` method.

```
$all = imagez()->all();
unset($all[23452]);                           // Say you don't like this one

imagez()->replaceAll($all);

imagez()->path();                             // Will never include image #23452
```

**Combining generators**

Maybe you like catz and dogz and foodz and want your placeholders/avatars to include multiple sources. This can be achieved easily:

```
$generator = catz()->combine(dogz(), foodz());
// or
$generator = CombineImagez::make(catz(), dogz(), foodz());

// Then interact with it as you otherwise would:
$generator->path();                           // path to a dog image
$generator->path();                           // path to a cat image
$generator->path();                           // path to a food image
```

Roadmap
-------

[](#roadmap)

- May add customisable filtering like `imagez()->red()->path()` and `imagez()->red()->iterate()->getCurrentImagePath()`
- May add image intervention as an optional dependency for resizing: `imagez()->resize(128)->path()`
- Add more images and packages

Author
------

[](#author)

- [Bradie Tilley](https://github.com/bradietilley)

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

812d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44430471?v=4)[Bradie Tilley](/maintainers/bradietilley)[@bradietilley](https://github.com/bradietilley)

---

Top Contributors

[![bradietilley](https://avatars.githubusercontent.com/u/44430471?v=4)](https://github.com/bradietilley "bradietilley (13 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bradietilley-faker-imagez/health.svg)

```
[![Health](https://phpackages.com/badges/bradietilley-faker-imagez/health.svg)](https://phpackages.com/packages/bradietilley-faker-imagez)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M10](/packages/renatomarinho-laravel-page-speed)[illuminate/pagination

The Illuminate Pagination package.

12234.1M1.0k](/packages/illuminate-pagination)[illuminate/pipeline

The Illuminate Pipeline package.

9349.2M282](/packages/illuminate-pipeline)[illuminate/redis

The Illuminate Redis package.

8314.6M375](/packages/illuminate-redis)[illuminate/cookie

The Illuminate Cookie package.

244.6M137](/packages/illuminate-cookie)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
