Download the PHP package batdan/midjourney-api-php without Composer
On this page you can find all versions of the php package batdan/midjourney-api-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download batdan/midjourney-api-php
More information about batdan/midjourney-api-php
Files in batdan/midjourney-api-php
Package midjourney-api-php
Short Description Generate images Midjourney (Discord API). URLs in prompt accepted
License MIT
Informations about the package midjourney-api-php
Utilize the Discord API to generate images with the Midjourney Bot.
This PHP library offers a user-friendly interface for creating images with the Midjourney Bot, leveraging the capabilities of the Discord API.
This version has the capability to incorporate example images via URLs into the Midjourney prompts, providing full compatibility with both private and public channels.
Installation
You can seamlessly integrate this library into your project using Composer. To do so, execute the following command in your project's root directory:
composer require batdan/midjourney-api-php
Usage
Fundamental Usage Instructions
To generate an image with the Midjourney Bot, initiate an instance of the Midjourney class:
Constructor
$discordChannelId
:- Substitute this value with the Channel ID where the Midjourney Bot has been installed. The Channel ID can be obtained by right-clicking on the channel and selecting Copy Channel ID.
- Keep in mind that you can invite the Midjourney Bot to your own server to better organize your work. For more information, refer to https://docs.midjourney.com/docs/invite-the-bot
-
$discordUserToken
:-
To retrieve your Discord User Token, you will need to use the Developer Tools in your browser and look into the network data. Here are the steps:
- Open Discord in your browser (not the app).
- Open the Developer Tools (you can typically open this by pressing F12 or Ctrl + Shift + I on Windows/Linux or Cmd + Option + I on MacOS).
- Navigate to the "Network" tab.
- In the filter box, type "messages" to narrow down the list of network requests.
- Send a message in any Discord channel.
- Look at the network requests that pop up after sending the message, select the one that has "messages" in its name.
- Within the Headers tab, look for the request header named "Authorization". The value of this header is your User Token.
Important Note: Keep your User Token strictly confidential. Anyone who has your token can take control of your Discord account. Never share it with anyone and don't publish it online. If you think your token may have been compromised, change your password immediately as this will cause your current token to become invalid.
-
Optimal Performance: Consider Using the CLI Script
To ensure optimal performance and avoid any potential execution time issues, we recommend utilizing the CLI (Command Line Interface) script for your task. The CLI script provides a streamlined and efficient environment, allowing for faster processing and smoother execution.
Before running the script, please fill in the Channel ID and User Token in the example.php file:
The process can take approximately one minute.
Automatically Generated Image: