1. Go to this page and download the library: Download katema/laravel-genai 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/ */
katema / laravel-genai example snippets
use Katema\LaravelGenAI\Facades\AI;
$response = AI::text('Write a product description for a coffee mug');
echo $response->content;
use Katema\LaravelGenAI\Traits\HasAI;
class Product extends Model
{
use HasAI;
}
$product = Product::find(1);
// Generate a summary
$summary = $product->summarize();
// Generate a description
$description = $product->describe();
// Ask questions about the model
$insights = $product->insights('What makes this product unique?');
// Use OpenAI
$response = AI::driver('openai')->text('Hello');
// Use Claude
$response = AI::driver('claude')->text('Hello');