PHPackages                             ferranfg/midjourney-php - 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. ferranfg/midjourney-php

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

ferranfg/midjourney-php
=======================

Generate images using Midjourney Bot through the Discord API.

v2.2.0(2y ago)1345.1k↓50%34[5 issues](https://github.com/ferranfg/midjourney-discord-api-php/issues)1MITPHPPHP ^8.1

Since Apr 15Pushed 2y ago6 watchersCompare

[ Source](https://github.com/ferranfg/midjourney-discord-api-php)[ Packagist](https://packagist.org/packages/ferranfg/midjourney-php)[ Fund](https://ko-fi.com/ferranfg)[ RSS](/packages/ferranfg-midjourney-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (7)Used By (1)

Midjourney PHP Library for Discord API Image Generation
=======================================================

[](#midjourney-php-library-for-discord-api-image-generation)

This PHP library provides a simple interface for generating images using the Midjourney Bot through the Discord API.

[![Midjourney PHP Library for Discord API](/.github/img/demo.gif)](/.github/img/demo.gif)

[![](https://camo.githubusercontent.com/49d5cab41a34562f0f626679e40e0a681b66586b0de2576d2125a00a3fe73ede/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66657272616e66672f6d69646a6f75726e65792d706870)](https://camo.githubusercontent.com/49d5cab41a34562f0f626679e40e0a681b66586b0de2576d2125a00a3fe73ede/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66657272616e66672f6d69646a6f75726e65792d706870)[![](https://camo.githubusercontent.com/2250acf5e7aa52f7094e9cf6e1fa5758d32995466c64d81bd1c5b17579785acd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66657272616e66672f6d69646a6f75726e65792d706870)](https://camo.githubusercontent.com/2250acf5e7aa52f7094e9cf6e1fa5758d32995466c64d81bd1c5b17579785acd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66657272616e66672f6d69646a6f75726e65792d706870)[![](https://camo.githubusercontent.com/2583112b0dee14073d7c3a3f85fe6bbb10664f3b2a8dbf77ea950f14b6ea5a0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66657272616e66672f6d69646a6f75726e65792d706870)](https://camo.githubusercontent.com/2583112b0dee14073d7c3a3f85fe6bbb10664f3b2a8dbf77ea950f14b6ea5a0b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66657272616e66672f6d69646a6f75726e65792d706870)

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

[](#installation)

You can install this library using Composer. Run the following command in your project directory:

`composer require ferranfg/midjourney-php`

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

To generate an image using the Midjourney Bot, you first need to create an instance of the `Midjourney` class:

```
use Ferranfg\MidjourneyPhp\Midjourney;

$midjourney = new Midjourney($discord_channel_id, $discord_user_token);

$message = $midjourney->generate('An astronaut riding a horse');

return $message->upscaled_photo_url;
```

### Constructor

[](#constructor)

- `$discord_channel_id` - Replaces this value with the Channel ID where the Midjourney Bot is installed. You can get the Channel ID right-clicking on the channel and **Copy Channel ID**.

    Remember that you can invite the Midjourney Bot to your own server to organize your work
- `$discord_user_token` - Automatic user accounts (self-bots) are not allowed by Discord and can result in an account termination if found, so use it at your own risk.

    To get your user token, visit  and open the **Network** tab inside the **Developers Tools**. Find between your XHR requests the `Authorization` header.

    [![Discord User Token](/.github/img/authorization.jpg)](/.github/img/authorization.jpg)

### Methods

[](#methods)

#### `$midjourney->imagine($prompt)`

[](#midjourney-imagineprompt)

This method generates an image using a prompt and returns an object that represents the message containing the generated image. The `$prompt` parameter is a string that will be used to generate the image.

```
$imagine_object = $midjourney->imagine('An astronaut riding a horse');
```

#### `$midjourney->getImagine($prompt)`

[](#midjourney-getimagineprompt)

This method returns a previously generated object that represents the message containing the image generated by the given prompt. The `$prompt` parameter is the string used to generate the image.

```
$imagine_object = $midjourney->getImagine('An astronaut riding a horse');
```

#### `$midjourney->upscale($imagine_object, $upscale_index)`

[](#midjourney-upscaleimagine_object-upscale_index)

This method upscales an image contained in the given object and returns the URL of the upscaled image. The `$imagine_object` parameter is the object returned from the `imagine` / `getImagine` methods. The `$upscale_index` parameter is an integer between 0 and 3 that represents the option provided by the MJ bot we want to upscale.

```
$upscaled_image_url = $midjourney->upscale($imagine_object, 2);
```

#### `$midjourney->getUpscale($imagine_object, $upscale_index)`

[](#midjourney-getupscaleimagine_object-upscale_index)

This method returns the URL of a previously upscaled image generated by the given message and with the given option of upscaling. The `$imagine_object` parameter is the object returned from the `imagine` / `getImagine` methods. The `$upscale_index` parameter is an integer between 0 and 3 that represents the option provided to the MJ bot we upscaled.

```
$upscaled_image_url = $midjourney->getUpscale($imagine_object, 2);
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.8% 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 ~47 days

Recently: every ~58 days

Total

6

Last Release

892d ago

Major Versions

v1.0.1 → v2.0.02023-05-05

### Community

Maintainers

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

---

Top Contributors

[![ferranfg](https://avatars.githubusercontent.com/u/195239?v=4)](https://github.com/ferranfg "ferranfg (15 commits)")[![lenomosh](https://avatars.githubusercontent.com/u/22171247?v=4)](https://github.com/lenomosh "lenomosh (1 commits)")

---

Tags

midjourneymidjourney-api-botmidjourney-app-apimidjourney-botmidjourneymidjourney-botmidjourney-api-bot

### Embed Badge

![Health badge](/badges/ferranfg-midjourney-php/health.svg)

```
[![Health](https://phpackages.com/badges/ferranfg-midjourney-php/health.svg)](https://phpackages.com/packages/ferranfg-midjourney-php)
```

###  Alternatives

[opentok/opentok

OpenTok is a platform for creating real time streaming video applications, created by TokBox.

1413.0M10](/packages/opentok-opentok)[batdan/midjourney-api-php

Generate images Midjourney (Discord API). URLs in prompt accepted

222.2k](/packages/batdan-midjourney-api-php)[automattic/wistia-php

PHP wrapper for Wistia API

1431.9k](/packages/automattic-wistia-php)[daun/statamic-placeholders

Generate low-quality image placeholders for lazyloading Statamic assets

106.6k](/packages/daun-statamic-placeholders)[daun/statamic-mux

Seamless video encoding and streaming using Mux on Statamic sites

132.3k](/packages/daun-statamic-mux)

PHPackages © 2026

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