PHP code example of ami-praha / ai-text-tool

1. Go to this page and download the library: Download ami-praha/ai-text-tool 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/ */

    

ami-praha / ai-text-tool example snippets


return [
    'default_language' => 'english',
    'custom_language_path' => resource_path('ai-text-tool/languages'),
    'openai_api_key' => env('OPENAI_API_KEY'),
    'openai_model' => 'gpt-4.1-mini',
    'openai_base_url' => 'https://api.openai.com/v1',
    'timeout' => 60,
];

use AmiPraha\AiTextTool\Facades\AiTextTool;
use AmiPraha\AiTextTool\Language;

$summary = AiTextTool::summarize($sourceText, 450);
$headline = AiTextTool::headline($sourceText, 50);
$translation = AiTextTool::translate($sourceText);
$repaired = AiTextTool::repair($sourceText);

$summary = AiTextTool::usingLanguage(Language::Czech)->summarize($sourceText, 450);
$headline = AiTextTool::usingLanguage(Language::German)->headline($sourceText, 50);
$translation = AiTextTool::usingLanguage(Language::Slovak)->translate($sourceText);

$translation = AiTextTool::usingLanguage(Language::German)->fromLanguage(Language::Czech)->translate($sourceText);
$summary = AiTextTool::fromLanguage(Language::Czech)->summarize($sourceText, 300);
bash
php artisan vendor:publish --tag=ai-text-tool-config
bash
php artisan vendor:publish --tag=ai-text-tool-languages