PHP code example of darvis / laravel-ai-generator

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

    

darvis / laravel-ai-generator example snippets


use Darvis\LaravelAiGenerator\ContentRequest;
use Darvis\LaravelAiGenerator\Facades\AiGenerator;

$result = AiGenerator::generate(new ContentRequest(
    topic: 'The benefits of Laravel for web development',
    language: 'en',
    s
$result->seoDescription;  // the model is asked for at most 155 characters

$result = AiGenerator::using('claude')->generate($request);
$result = AiGenerator::using('openai', 'gpt-4.1-mini')->generate($request);
bash
php artisan vendor:publish --tag=ai-generator-config