PHP code example of globetrotters-ai / symfony-bundle

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

    

globetrotters-ai / symfony-bundle example snippets


Globetrotters\AiPresenceBundle\GlobetrottersAiPresenceBundle::class => ['all' => true],

use Symfony\Bundle\FrameworkBundle\HttpCache\HttpCache;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class AppCache extends HttpCache
{
    private const AI_AGENTS = '/OAI-SearchBot|ChatGPT-User|Claude-SearchBot|Claude-User|PerplexityBot|Perplexity-User|meta-externalfetcher|meta-webindexer|xAI-Grok|Grok-DeepSearch|DuckAssistBot|ExaSearchBot/i';

    protected function lookup(Request $request, bool $catch = false): Response
    {
        if (preg_match(self::AI_AGENTS, (string) $request->headers->get('User-Agent'))) {
            return $this->pass($request, $catch);
        }

        return parent::lookup($request, $catch);
    }
}

  Link: </.well-known/api-catalog>; rel="api-catalog", </llms.txt>; rel="service-doc", </.well-known/mcp.json>; rel="mcp", </.well-known/agent-card.json>; rel="agent-card", </.well-known/ai-catalog.json>; rel="ai-catalog"