PHP code example of ithilbert / ai-manifest

1. Go to this page and download the library: Download ithilbert/ai-manifest 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/ */

    

ithilbert / ai-manifest example snippets


// routes/api.php

Route::get('/api/domains', [DomainController::class, 'index'])
    ->name('domains.index')
    ->aiManifest()
    ->summary('Alle Domains auflisten');

Route::post('/api/domains', [DomainController::class, 'store'])
    ->name('domains.create')
    ->aiManifest()
    ->summary('Domain erstellen')
    ->auth()                                        // auth=true
    ->param('name', 'string', true, 'Domain-Name') // name, type, cp');

// AppServiceProvider::boot()
AiManifest::addGenerator(function () {
    return DB::table('api_endpoints')->get()->map(fn ($e) => [
        'id'      => $e->slug,
        'path'    => $e->path,
        'method'  => $e->method,
        'summary' => $e->description,
        'auth'    => (bool) $e->

return [
    'name'        => null,              // null → app.name
    'description' => '',
    'version'     => '1.0',
    'auth'        => [
        'type'           => 'bearer',
        'token_endpoint' => '/api/token',
    ],
    'mechanisms'  => [
        // ['type' => 'http_api', 'base' => '/api', 'schema' => '/.well-known/openapi.json'],
        // ['type' => 'mcp', 'url' => 'https://example.com/mcp'],
    ],
    'rate_limits' => null,
    'contact'     => null,
    'public'      => true,              // false → kein öffentlicher Zugriff
    'middleware'  => [],                // z.B. ['auth:sanctum']
    'cache_ttl'   => 3600,             // 0 = kein Cache
];
bash
php artisan vendor:publish --tag=ai-manifest-config
bash
php artisan ai-manifest:generate
# Default: public/.well-known/ai-manifest.json

php artisan ai-manifest:generate --path=/custom/path/manifest.json