1. Go to this page and download the library: Download vinkius-labs/laravel-vurb 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/ */
vinkius-labs / laravel-vurb example snippets
// app/Vurb/Presenters/PatientPresenter.php — generated by your AI agent
class PatientPresenter extends VurbPresenter
{
public function toArray($request): array
{
return [
'id' => $this->id,
'name' => $this->name,
'status' => $this->status,
'physician' => $this->attending_physician,
];
// ssn, diagnosis, internal_notes — physically absent from response
}
public function systemRules(): array
{
return [
'HIPAA: diagnosis visible in UI blocks but NEVER in conversation text.',
'Always confirm physician identity before discharge actions.',
];
}
public function suggestActions(): array
{
if ($this->status === 'cleared') {
return [['tool' => 'patients.discharge', 'reason' => 'Physician has signed off']];
}
return [['tool' => 'patients.sign_off', 'reason' => 'Awaiting physician sign-off']];
}
}
// app/Vurb/Tools/Patients/DischargePatient.php — generated by your AI agent
#[Description('Discharge a patient after physician sign-off')]
#[Instructions('NEVER call without verifying physician sign-off. Always confirm patient identity.')]
#[Presenter(PatientPresenter::class)]
#[FsmBind(states: ['cleared'], event: 'DISCHARGE')]
class DischargePatient extends VurbTool
{
public function verb(): string { return 'mutation'; }
public function handle(
#[Param(description: 'Patient ID', example: 'PAT-001')]
string $id,
): Patient {
$patient = Patient::findOrFail($id);
$patient->update(['status' => 'discharged', 'discharged_at' => now()]);
return $patient;
}
}
// app/Vurb/Tools/GetCustomerProfile.php
namespace App\Vurb\Tools;
use Vinkius\Vurb\Attributes\Param;
use Vinkius\Vurb\Tools\VurbTool;
class GetCustomerProfile extends VurbTool
{
public function description(): string
{
return 'Retrieve a customer profile by ID.';
}
public function verb(): string
{
return 'query';
}
public function handle(
#[Param(description: 'The customer ID', example: 42)]
int $id,
): array {
$customer = \App\Models\Customer::findOrFail($id);
return $customer->only(['id', 'name', 'plan', 'created_at']);
}
}
use Vinkius\Vurb\Tools\VurbTool;
class ListOrders extends VurbTool
{
public function description(): string
{
return 'List recent orders for a customer.';
}
public function handle(int $customer_id, int $limit = 10): array
{
return Order::where('customer_id', $customer_id)
->latest()
->limit($limit)
->get()
->toArray();
}
}
use Vinkius\Vurb\Attributes\{Tool, Param, Description, Instructions, Tags, Presenter, Cached, Invalidates, FsmBind, Concurrency};
#[Description('Deep search across all customer records')]
#[Instructions('Only call when the user explicitly asks for a customer lookup. Never infer customer IDs.')]
#[Tags('crm', 'search')]
#[Cached(ttl: 120)]
#[Concurrency(max: 3)]
class SearchCustomers extends VurbTool
{
public function description(): string
{
return 'Search customers by name or email.';
}
public function verb(): string
{
return 'query';
}
public function handle(
#[Param(description: 'Search query — name, email, or phone', example: '[email protected]')]
string $query,
#[Param(description: 'Max results to return')]
int $limit = 20,
): array {
return Customer::search($query)->take($limit)->get()->toArray();
}
}
public function handle(
int $id,
\App\Services\CrmGateway $crm, // ← injected by container
\Illuminate\Cache\Repository $cache, // ← injected by container
): array {
return $cache->remember("customer.{$id}", 60, fn () => $crm->find($id));
}
// app/Vurb/Presenters/CustomerPresenter.php
namespace App\Vurb\Presenters;
use Vinkius\Vurb\Presenters\VurbPresenter;
class CustomerPresenter extends VurbPresenter
{
public function toArray($request): array
{
// Only these fields reach the LLM — email is stripped
return [
'id' => $this->id,
'name' => $this->name,
'plan' => $this->plan,
];
}
public function systemRules(): array
{
return [
'Never reveal the customer email address.',
'Always use the customer name in responses.',
'For billing questions, suggest the billing.get_invoice tool.',
];
}
public function uiBlocks(): array
{
return [
['type' => 'summary', 'title' => $this->name, 'subtitle' => "Plan: {$this->plan}"],
];
}
public function suggestActions(): array
{
return [
['tool' => 'customers.update', 'reason' => 'Edit customer details'],
['tool' => 'billing.get_invoice', 'reason' => 'View billing history'],
];
}
}
use Vinkius\Vurb\Attributes\Presenter;
#[Presenter(CustomerPresenter::class)]
class GetCustomerProfile extends VurbTool
{
// handle() returns the Customer model
// Presenter filters, enriches, and governs the response
}
// app/Vurb/Tools/Crm/Router.php
namespace App\Vurb\Tools\Crm;
use Vinkius\Vurb\Tools\VurbRouter;
class Router extends VurbRouter
{
public string $prefix = 'crm';
public string $description = 'CRM operations — leads, contacts, deals';
public array $middleware = [
\App\Vurb\Middleware\RequireCrmAccess::class,
];
}
use Vinkius\Vurb\Attributes\FsmBind;
#[FsmBind(states: ['confirmed'], event: 'PAY')]
class ProcessPayment extends VurbTool
{
// Only visible when order_flow is in 'confirmed' state
// Triggers PAY event on execution → transitions to 'paid'
}