PHP code example of ferranfg / midjourney-php

1. Go to this page and download the library: Download ferranfg/midjourney-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ferranfg / midjourney-php example snippets


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;

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

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

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

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