Spectre - AI Browser And Bot Detection LibrarySpectre - AI Browser And Bot Detection Library
Spectre - AI Protection Suite & Bot Detection for PHPSpectre - AI Browser And Bot Detection Library
Spectre - AI Protection Suite & Bot Detection for PHP
Overview
🚀 Spectre – AI Browser & Bot Detection Library
Spectre is a professional, high-performance PHP library designed for detecting AI browsers and bots. Built with modern PHP 8.2+ features, it offers a robust hybrid detection system combining server-side User-Agent analysis with client-side JavaScript fingerprinting.
💡 Why Choose Spectre?
Spectre is built to be lightweight yet powerful. It integrates seamlessly into any PHP project, whether you're building a CMS, analytics platform, content protection system, or API gateway. The hybrid detection approach ensures high accuracy even for browsers that actively mask their identity.
🌐 Browser & Bot Support
| Browser/Bot | Detection Method | Accuracy |
|---|---|---|
| Comet | Chrome 140+ + AI APIs | ⭐⭐⭐⭐⭐ High |
| Arc | CSS Variable Fingerprinting | ⭐⭐⭐⭐⭐ High |
| Brave | Navigator Object | ⭐⭐⭐⭐⭐ High |
| SearchGPT | User-Agent Analysis | ⭐⭐⭐⭐⭐ High |
| Copilot | User-Agent Analysis | ⭐⭐⭐⭐ Good |
| ClaudeBot | User-Agent Analysis | ⭐⭐⭐⭐⭐ High |
| GPTBot | User-Agent Analysis | ⭐⭐⭐⭐⭐ High |
Features
✨ Key Features
- Hybrid Detection: Combines server-side PHP analysis with client-side JavaScript fingerprinting for maximum accuracy.
- AI Browser Support: Detects Comet, Arc, Brave, and other emerging AI browsers.
- Bot Detection: Identifies SearchGPT, ClaudeBot, GPTBot, and Microsoft Copilot.
- Zero Dependencies: Standalone library that works with any PHP 8.2+ project.
- Modular Architecture: Driver-based system for easy extensibility.
- Privacy-Focused: Detects browser technology without compromising user privacy.
- Modern PHP: Utilizes enums, readonly properties, and strict typing.
Requirements
⚙️ Requirements
- PHP 8.2 or higher
- No external dependencies required
Instructions
📖 Instructions
Basic Server-Side Detection
<code class="language-php">
<!--?php
use AlizHarbSpectreSpectre;
if (Spectre::isAiBrowser()) {
$browser = Spectre::detect();
echo "Detected: " . $browser--->value;
}
?>
</code>
Simple Testing Example
<code class="language-php">
<!--?php
require 'vendor/autoload.php';
use AlizHarbSpectreSpectre;
?-->
<title>Spectre Test</title>
<script><?php echo Spectre::getJsSnippet(); ?></script>
<!--?php if (Spectre::isAiBrowser()): ?-->
<p>✅ AI Browser Detected: <!--?php echo Spectre::detect()--->value; ?></p>
<!--?php else: ?-->
<p>ℹ️ Standard Browser Detected</p>
<!--?php endif; ?-->
</code>
Hybrid Detection (Recommended)
Add the JavaScript snippet in your <head> and check results on page load:
<code class="language-php">
<script><?php echo AlizHarbSpectreSpectre::getJsSnippet(); ?></script>
<!--?php
use AlizHarbSpectreSpectre;
use AlizHarbSpectreEnumsBrowserType;
$browser = Spectre::detect();
if ($browser) {
switch ($browser) {
case BrowserType::COMET:
echo "Comet browser detected";
break;
case BrowserType::ARC:
echo "Arc browser detected";
break;
case BrowserType::BRAVE:
echo "Brave browser detected";
break;
case BrowserType::SEARCH_GPT:
case BrowserType::GPT_BOT:
case BrowserType::CLAUDE:
echo "AI bot detected";
break;
}
}
?-->
</code>
Advanced Usage
Custom User-Agent testing:
<code class="language-php">
<!--?php
use AlizHarbSpectreSpectre;
Spectre::init('Mozilla/5.0 (compatible; OAI-SearchBot/1.0)');
if (Spectre::isAiBrowser()) {
echo "Detected: " . Spectre::detect()--->value;
}
?>
</code>
Conditional content delivery:
<code class="language-php">
<!--?php
use AlizHarbSpectreSpectre;
use AlizHarbSpectreEnumsBrowserType;
$browser = Spectre::detect();
if ($browser === BrowserType::COMET || $browser === BrowserType::ARC) {
include 'templates/enhanced-content.php';
} elseif ($browser === BrowserType::GPT_BOT || $browser === BrowserType::CLAUDE) {
include 'templates/bot-content.php';
} else {
include 'templates/standard-content.php';
}
?-->
</code>
Best Practices
- Always use hybrid detection for accuracy
- Cache detection results to improve performance
- Respect user privacy
- Handle null results gracefully
- Keep the package updated for new AI browsers
Other items by this author
|
PHP Script Installation Service
Don't worry about the installation of your script! Have your PHP Script installed for you.
|
$39 | Buy now |
| Category | Scripts & Code / PHP Scripts / Security |
| First release | 3 December 2025 |
| Last update | 3 December 2025 |
| Software version | PHP 8.2, PHP 8.3, PHP 8.4 |
| Files included | .php, .html |
| Tags | Security, wordpress plugin, firewall, honeypot, php security, ai protection, bot detection, scraper blocker, chatgpt blocker, anti-scraping, laravel package, symfony bundle, fake data, poisoning, llm protection |








