PHPackages                             swatty007/faker-image-generator - 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. swatty007/faker-image-generator

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

swatty007/faker-image-generator
===============================

Placeholder Image Generator for FakerPHP

3.0.0(2y ago)01.8k—0%MITPHPPHP ^8.1

Since Oct 6Pushed 2y agoCompare

[ Source](https://github.com/swatty007/faker-image-generator)[ Packagist](https://packagist.org/packages/swatty007/faker-image-generator)[ Docs](https://github.com/swatty007/faker-image-generator)[ RSS](/packages/swatty007-faker-image-generator/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (6)Versions (5)Used By (0)

faker-image-generator
=====================

[](#faker-image-generator)

[![Package Banner](./docs/banner.png "Package Banner")](./docs/banner.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e0c97287a3251497944b420d39aa377ea112f434a8d01d49a8cf7e78f0985e9f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7377617474793030372f66616b65722d696d6167652d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swatty007/faker-image-generator)[![License: MIT](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://opensource.org/licenses/MIT)[![Build Status](https://github.com/swatty007/faker-image-generator/actions/workflows/run-tests.yaml/badge.svg)](https://github.com/swatty007/faker-image-generator/actions/workflows/run-tests.yaml)[![Code Style](https://github.com/swatty007/faker-image-generator/actions/workflows/check-coding-standards.yaml/badge.svg)](https://github.com/swatty007/faker-image-generator/actions/workflows/check-coding-standards.yaml)[![Quality Score](https://camo.githubusercontent.com/f3a2702c716b37e962faed97e7156be94e8ea5057f92447814a7a93d08c85608/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7377617474793030372f66616b65722d696d6167652d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/swatty007/faker-image-generator)[![Total Downloads](https://camo.githubusercontent.com/9f5b39ff6fd39dcf2ecc5f6914d64e37e9eb3b54d8c1356e152489351f50e06a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7377617474793030372f66616b65722d696d6167652d67656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/swatty007/faker-image-generator)

Generator of placeholder-type images using **GD** for **[fzaninotto/Faker](https://github.com/fzaninotto/Faker)**to quickly generate fake images within your application or tests, without the need to rely on external services.

> This is a fork from **[bruceheller/images-generator](https://github.com/bruceheller/images-generator)** as that package seems to not be actively maintained anymore.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require swatty007/faker-image-generator
```

Configuration
-------------

[](#configuration)

After installing the package you can publish the configuration file via:

```
php artisan vendor:publish --provider="Swatty007\FakerImageGenerator\FakerImageGeneratorServiceProvider"
```

It contains some optional configuration parameters and is fully documented.

> The configuration allows you to define some global image properties which will be shared across all Generator Instances. This is an addition to the original package to make is easier to share a similar style throughout your application.

Usage
-----

[](#usage)

Use the `FakerImageGenerationProvider` class in combination with [Faker](https://github.com/fakerphp/faker) to produce new images:

```
$faker = Factory::create();
$imageGenerator = new FakerImageGenerationProvider($faker);
$image = $faker->imageGenerator();
```

It will generate a black png picture of 640\*480 pixels inside your temp directory (if available) and return the full path of the picture like this: `'/tmp/13b73edae8443990be1aa8f1a483bc27.png'`.

### Parameters

[](#parameters)

The `imageGenerator()` method allows you to define rendering options on a per element basis, those options are identical to your configuration properties and will allow you quickly generate unique images.

Examples:
---------

[](#examples)

```
$faker->imageGenerator();
```

Will generate a 640x480 black png picture with the text '640x480' in white.

[![Default Image](./docs/default-image.png "Default Image")](./docs/default-image.png)

```
$faker->imageGenerator('img', 640, 480, 'png', true, 'Faker', '#0018ff', '#ffd800');
```

Will generate a 640x480 blue png picture with the text 'Faker' in yellow inside an `img` directory of your project and return the full path such as `'img/f523f8bec6ed65fb1d63ae8d09850f9c.png'` like this:

[![Custom Image](./docs/custom-image.png "Custom Image")](./docs/custom-image.png)

More complex example using the power of [Faker](https://github.com/fzaninotto/Faker):

```
$faker->imageGenerator('img', $faker->numberBetween(600, 800), $faker->numberBetween(400, 600), 'jpg', true, $faker->word, $faker->hexColor, $faker->hexColor);
```

Will return a jpeg of a random color picture with a width between 600 and 800 pixels, height between 400 and 600 pixels, with a random word written in a random color!

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

TODO
----

[](#todo)

As this is mainly a fork of the existing package, to get it running within modern applications, its future development plans could apply to this package as well. However, its current functionality fulfills my needs. Nonetheless, some TODOs remain &amp; are open for pull requests 🧐

- Improve Readme
- Transition to GitHub Actions
- Improve &amp; Extend existing tests!
- Add support for **ImageMagick** and/or **GraphicsMagick** for faster generation of pictures.

Otherwise, any suggestion is welcome! You can fork this project and submit your PR :)

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Martin Niehoff](https://github.com/swatty007)
- [Bruce Heller](https://github.com/bruceheller)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

The **[Roboto](https://github.com/google/roboto)** font file included in this project is under Apache Licence 2.0 as mentioned on the [Roboto](https://github.com/google/roboto) repository.

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~970 days

Total

4

Last Release

907d ago

Major Versions

1.0.1 → 2.0.02021-02-24

2.0.0 → 3.0.02023-09-26

PHP version history (3 changes)1.0.0PHP &gt;=5.3.0

2.0.0PHP ^7.4|^8.0

3.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/77f0b9661afdeab758f22b28bd1967aed025aa0e6a68fd6497b2195253ba1d4d?d=identicon)[swatty](/maintainers/swatty)

---

Top Contributors

[![bruceheller](https://avatars.githubusercontent.com/u/3966713?v=4)](https://github.com/bruceheller "bruceheller (15 commits)")[![swatty007](https://avatars.githubusercontent.com/u/38767638?v=4)](https://github.com/swatty007 "swatty007 (10 commits)")[![AlphaRecon19](https://avatars.githubusercontent.com/u/3878240?v=4)](https://github.com/AlphaRecon19 "AlphaRecon19 (5 commits)")

---

Tags

fakerfixturesdataimages-generatorimagesgeneratorswatty007

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/swatty007-faker-image-generator/health.svg)

```
[![Health](https://phpackages.com/badges/swatty007-faker-image-generator/health.svg)](https://phpackages.com/packages/swatty007-faker-image-generator)
```

###  Alternatives

[fakerphp/faker

Faker is a PHP library that generates fake data for you.

3.9k349.3M2.9k](/packages/fakerphp-faker)[bheller/images-generator

Generator of placeholder images for Faker

573.1M3](/packages/bheller-images-generator)[mbezhanov/faker-provider-collection

A collection of custom providers for the Faker library

2138.3M23](/packages/mbezhanov-faker-provider-collection)[xefi/faker-php

Faker allows you to generate realistic fake data for your php applications

15114.4k14](/packages/xefi-faker-php)[xefi/faker-php-laravel

Faker php integration with laravel

1813.5k](/packages/xefi-faker-php-laravel)[andrefigueira/blog-article-faker

Generate random blog article titles and content (including markdown) using faker

1415.0k](/packages/andrefigueira-blog-article-faker)

PHPackages © 2026

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