PHP code example of yaknet / divan
1. Go to this page and download the library: Download yaknet/divan 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/ */
yaknet / divan example snippets
use YakNet\Divan\Core\Divan;
// Divan'ı başlat
Divan::register([
'gemini_api_key' => $_ENV['GEMINI_API_KEY'] ?? '', // AI şiirleri için isteğe bağlı
'active' => true // .env'den okumak için belirtmeyebilirsiniz
]);
use Whoops\Run;
use Whoops\Handler\PrettyPageHandler;
use YakNet\Divan\Whoops\DivanHandler;
$whoops = new Run;
// 1. Şairane Divan Handler'ı ekle
$whoops->pushHandler(new DivanHandler([
'gemini_api_key' => $_ENV['GEMINI_API_KEY'] ?? ''
]));
// 2. Teknik Whoops Handler'ını ekle (Toggled fallback)
$whoops->pushHandler(new PrettyPageHandler);
$whoops->register();