On this page
Getting Started
Batoi AIF can be used with Composer or as a ZIP/drop-in package. Composer is preferred for application projects because it keeps dependency loading and updates predictable.
Requirements
- PHP 8.3 or newer
- cURL extension for HTTP provider transports
- Composer for package-managed installs
Composer Install
composer require batoi/aifMinimal Gateway Example
<?php
use Batoi\Aif\Gateway\AifGateway;
use Batoi\Aif\Gateway\InferenceRequest;
use Batoi\Aif\Providers\InMemoryProviderRegistry;
use Batoi\Aif\Providers\MockProvider;
$registry = new InMemoryProviderRegistry();
$registry->register(new MockProvider('mock'));
$gateway = new AifGateway(providerRegistry: $registry);
$response = $gateway->infer(new InferenceRequest(
prompt: 'Summarize the control review notes.',
provider: 'mock',
model: 'mock-model'
));Production Pattern
In production, place AIF behind a backend route, worker, or service. Browser pages and UIF interfaces should not call commercial AI providers directly with long-lived secrets.
Use this boundary:
- UI collects intent, context, and user input.
- Backend resolves permissions and workspace context.
- AIF applies provider, prompt, policy, execution, evaluation, and audit behavior.
- UI renders the response and any review state.
Next Step
Read Architecture to understand how the gateway, providers, prompts, policy, and audit contracts fit together.