Storage
ADP persists debug data through a StorageInterfaceAppDevPanel\Kernel\Storage\StorageInterfaceDebug data storage responsibility is to store debug data from collectors added abstraction. The default implementation, FileStorageAppDevPanel\Kernel\Storage\FileStorageClass FileStorage., writes JSON files to disk.
StorageInterface
interface StorageInterface
{
public function addCollector(CollectorInterface $collector): void;
public function getData(): array;
public function read(string $type, ?string $id = null): array;
public function write(string $id, array $summary, array $data, array $objects): void;
public function flush(): void;
public function clear(): void;
}Data Types
Each debug entry is stored as three separate pieces:
| Type | Constant | Contents |
|---|---|---|
| Summary | TYPE_SUMMARY | Timestamp, URL, HTTP status, collector names |
| Data | TYPE_DATA | Full collector payloads |
| Objects | TYPE_OBJECTS | Serialized PHP objects for deep inspection |
This separation allows the frontend to load summaries quickly without fetching full data.
FileStorage
FileStorageAppDevPanel\Kernel\Storage\FileStorageClass FileStorage. is the default production implementation. It writes JSON files to a configurable directory.
Key behaviors:
- Each debug entry produces three JSON files (summary, data, objects)
- Uses
LOCK_EXfor atomic writes to prevent corruption - Uses
flockfor garbage collection mutual exclusion - Supports configurable entry limit with automatic GC of old entries
Directory Structure
debug-data/
├── 000001.summary.json
├── 000001.data.json
├── 000001.objects.json
├── 000002.summary.json
├── 000002.data.json
├── 000002.objects.json
└── ...MemoryStorage
MemoryStorageAppDevPanel\Kernel\Storage\MemoryStorageClass MemoryStorage. is an in-memory implementation used exclusively for testing. It stores all data in PHP arrays with no disk I/O.
Write Sources
Storage receives data from two sources:
- Debugger flush -- After a request or console command completes, the Debugger
AppDevPanel\Kernel\DebuggerClass Debugger. callsflush()on the storage, which serializes all collector data. - Ingestion API -- The IngestionController
AppDevPanel\Api\Ingestion\Controller\IngestionControllerIngestion inspector API controller. callswrite()directly, allowing external (non-PHP) applications to send debug data via HTTP.
Extending Storage
To create a custom storage backend (e.g., Redis, database), implement StorageInterfaceAppDevPanel\Kernel\Storage\StorageInterfaceDebug data storage responsibility is to store debug data from collectors added and register it in your DI container. All six methods must be implemented. The read() method must support filtering by $type and optionally by $id.