1. Go to this page and download the library: Download martin-ro/laravel-herdr 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/ */
martin-ro / laravel-herdr example snippets
use MartinRo\Herdr\Facades\Herdr;
// Split the focused pane, run the test suite in the new pane, read the output.
$pane = Herdr::pane()->split('right', ratio: 0.4);
$pane->run('php artisan test');
$output = $pane->waitForOutput('Tests:')->text();
foreach (Herdr::panes()->withAgentStatus('blocked') as $pane) {
$pane->sendText('continue')->enter();
}
$pane = Herdr::pane('w1:p1'); // a handle by id
$pane = Herdr::pane(); // ...or the focused pane
$pane->run('npm run build'); // sendText + enter
$pane->type('y')->enter(); // chainable
$pane->sendKeys('ctrl+c'); // key combos: enter, esc, ctrl+c, f1...
$pane->sendKeys(['g', 'g']); // a sequence
$pane->read(lines: 100)->text(); // recent output as a string
$pane->read(source: 'recent_unwrapped')->lines(); // sources: visible|recent|recent_unwrapped|detection
$pane->read(format: 'ansi'); // raw output with escape sequences
$pane->read(stripAnsi: false); // override the server's strip default
$pane->waitForOutput('Compiled successfully'); // literal substring
$pane->waitForPattern('Tests:\s+\d+ passed', [ // regex
'timeout_ms' => 10000,
]);
$right = $pane->split('right', ratio: 0.33, options: [
'env' => ['HERDR_ROLE' => 'tests'],
]);
$pane->zoom(); // toggle
$pane->zoom('on'); // or 'off'
$pane->focus();
$pane->rename('build');
$pane->moveToTab('w1:t2', 'down'); // move into an existing tab
$pane->moveToNewTab(); // ...or a new tab
$pane->moveToNewWorkspace('lab'); // ...or a new workspace
$pane->layout(); // the containing tab's layout snapshot
$pane->close();
Herdr::agents()->all(); // Collection<Agent>
// Start an agent inside an existing pane. The name becomes its target.
$pane = Herdr::pane()->split('right');
$agent = Herdr::agents()->start('claude', 'reviewer', $pane, [
'args' => ['--continue'],
]);
// Prompt: Herdr types the text and presses Enter atomically. Optionally wait
// server-side until the agent settles.
$agent->prompt('summarise the failing test');
$agent->prompt('fix it', until: 'idle', timeoutMs: 120000);
Herdr::agent('reviewer')->sendKeys('esc'); // target by name
Herdr::agent('wA:p2')->wait('idle'); // ...or by pane id
$agent->read()->text();
$agent->explain();
$agent->focus();
$agent->kind(); // "claude"
$agent->name(); // "reviewer"
$agent->status(); // idle|working|blocked|done|unknown