Download the PHP package tanghengzhi/midjourney-php without Composer
On this page you can find all versions of the php package tanghengzhi/midjourney-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tanghengzhi/midjourney-php
More information about tanghengzhi/midjourney-php
Files in tanghengzhi/midjourney-php
Package midjourney-php
Short Description Generate images using Midjourney Bot through the Discord API.
License MIT
Informations about the package midjourney-php
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.
Installation
You can install this library using Composer. Run the following command in your project directory:
composer require ferranfg/midjourney-php
Usage
Basic usage
To generate an image using the Midjourney Bot, you first need to create an instance of the Midjourney
class:
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 https://docs.midjourney.com/docs/invite-the-bot
-
$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 https://discord.com/channels/@me and open the Network tab inside the Developers Tools. Find between your XHR requests the
Authorization
header.
Methods
$midjourney->imagine($prompt)
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.
$midjourney->getImagine($prompt)
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.
$midjourney->upscale($imagine_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.
$midjourney->getUpscale($imagine_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.