PHP code example of azlanali076 / image-generator

1. Go to this page and download the library: Download azlanali076/image-generator 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/ */

    

azlanali076 / image-generator example snippets


use Azlanali076\ImageGenerator\Facades\ImageGenerator;

// Generate an image
$imageResponse = ImageGenerator::generate(
    "A Cute White Cat"
);

// Check if the response is successful
if ($imageResponse['success']) {
    // Retrieve the image URL
    $url = $imageResponse['data'][0]['url'];
    echo "Image URL: " . $url;
} else {
    // Handle the error
    echo "Error: " . $imageResponse['message'];
}
bash
php artisan vendor:publish --provider="Azlanali076\ImageGenerator\ImageGeneratorServiceProvider"