PHPackages                             krisciunaskarolis/openai-images-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. [Image &amp; Media](/categories/media)
4. /
5. krisciunaskarolis/openai-images-generator

ActiveLibrary[Image &amp; Media](/categories/media)

krisciunaskarolis/openai-images-generator
=========================================

PHP client for OpenAI images generation

1.0.0(3y ago)61481[1 issues](https://github.com/krisciunaskarolis/openai-images-generator/issues)MITPHP

Since Dec 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/krisciunaskarolis/openai-images-generator)[ Packagist](https://packagist.org/packages/krisciunaskarolis/openai-images-generator)[ RSS](/packages/krisciunaskarolis-openai-images-generator/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

OpenAI Image generation
=======================

[](#openai-image-generation)

PHP client for OpenAI [image generation API](https://beta.openai.com/docs/guides/images/introduction) (beta).

Client allows:

- to generate images based on text prompts.
- to download and save generated images.

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

```
composer require krisciunaskarolis/openai-images-generator
```

### Authentication

[](#authentication)

The OpenAI API uses API keys for authentication. Visit your [API Keys page](https://beta.openai.com/account/api-keys) to retrieve the API key you'll use in your requests.

### Image generation

[](#image-generation)

To generate images based on text prompts:

```
use Krisciunas\OpenAi\Api\GenerateImageCommand;
use Krisciunas\OpenAi\Api\ImagePrompt;

$authorizationToken = 'YOUR-OPENAI-API-KEY';
$imagesGenerationCommand = new GenerateImageCommand();

$imagesData = $imagesGenerationCommand->execute(
    $authorizationToken,
    new ImagePrompt(
        'small kitty playing with red fish', //A text description of the desired images. The maximum length is 1000 characters.
        4, //Number of images to generate. Must be between 1 and 10
        ImagePrompt::SIZE_256x256, // The size of generated images
        ImagePrompt::FORMAT_URL //The format in which images are returned
    ),
);
```

### Saving images

[](#saving-images)

To save generated images:

```
$imagesPersistor = new ImagesPersist('/PATH/TO/IMAGES/DIRECTORY/');
$imagesPersistor->persist($imagesData, 'FILENAME_FORMAT_%s.png');
```

Both images response formats (urls and base\_64 encoded images data) are supported.

When saving images, placeholder in filename format will be replaced by images counter value, starting from 0.

Supported response formats
--------------------------

[](#supported-response-formats)

```
\Krisciunas\OpenAi\Api\ImagePrompt::FORMAT_URL;
\Krisciunas\OpenAi\Api\ImagePrompt::FORMAT_BASE_64;
```

Supported image sizes
---------------------

[](#supported-image-sizes)

```
\Krisciunas\OpenAi\Api\ImagePrompt::SIZE_256x256;
\Krisciunas\OpenAi\Api\ImagePrompt::SIZE_512x512;
\Krisciunas\OpenAi\Api\ImagePrompt::SIZE_1024x1024;
```

Limitations
-----------

[](#limitations)

According to OpenAI, The Images API is in beta. During this time the API and models will evolve. To ensure all users can prototype comfortably, the default rate limit is 20 images per minute, 50 per 5 minutes.

Authors
-------

[](#authors)

- [Karolis Kriščiūnas](mailto:karolis.krisciunas@gmail.com)

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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

Unknown

Total

1

Last Release

1298d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b746f0e22f1e520cbd8fb99871384a96937f52b4d3bb24b084504b47a50907a3?d=identicon)[karoliskrisciunas](/maintainers/karoliskrisciunas)

---

Top Contributors

[![krisciunaskarolis](https://avatars.githubusercontent.com/u/118339642?v=4)](https://github.com/krisciunaskarolis "krisciunaskarolis (2 commits)")[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (1 commits)")

---

Tags

aiai-clientsartificial-intelligenceopenaiimages-generatorimage-generation

### Embed Badge

![Health badge](/badges/krisciunaskarolis-openai-images-generator/health.svg)

```
[![Health](https://phpackages.com/badges/krisciunaskarolis-openai-images-generator/health.svg)](https://phpackages.com/packages/krisciunaskarolis-openai-images-generator)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2481.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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