PHP code example of thehocinesaad / stability-laravel

1. Go to this page and download the library: Download thehocinesaad/stability-laravel 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/ */

    

thehocinesaad / stability-laravel example snippets


use TheHocineSaad\StabilityLaravel\Facades\Stability;

$response = Stability::generations()->textToImage(
    'stable-diffusion-xl-1024-v1-0',
    [
        'text_prompts' => [
            [
                'text' => 'A lighthouse on a cliff',
                'weight' => 0.5
            ],
        ],
        'samples' => 1,
    ]
);

dd($response['artifacts'][0]['base64']);
// "iVBORw0KGgoAAAANSUhEUgAABAAAAQACAIAAADwf7zUAAM8MmNhQlgAAzwya..."
//// An image encoded in base64.