PHP code example of empiretwo / gaze-laravel

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

    

empiretwo / gaze-laravel example snippets


  use Naoray\GazeLaravel\Facades\Gaze;

  // Composition (fluent sugar)
  $session = Gaze::daemon()->session('agent-thread-a');
  $response = $session->clean($prompt);

  // Direct hot path (one PHP call = one JSONL line)
  $response = Gaze::daemon()->clean('agent-thread-a', $prompt);
  

use Naoray\GazeLaravel\Gaze;

$session = $gaze->clean($request->string('body'));
$reply = $llm->complete($session->cleanText);

return $gaze->restore($session, $reply);

foreach ($session->entries as $entry) {
    logger()->info('detected', [
        'class' => $entry->class,
        'token' => $entry->token,
        'family' => $entry->family,
    ]);
}

// Single-entry access:
$firstClass = $session->entries[0]->class ?? null;
bash
> composer config allow-plugins.empiretwo/gaze-laravel true
> 
json
> "config": {
>   "allow-plugins": {
>     "empiretwo/gaze-laravel": true
>   }
> }
>