ModelScribe’s driver system is open for extension: any class that implementsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/HypathStack/model-scribe/llms.txt
Use this file to discover all available pages before exploring further.
DriverInterface can act as a first-class audit driver. Whether you need to stream events to a webhook endpoint, push records into Elasticsearch, or fan out to a proprietary data warehouse, you can plug your implementation in without touching the package internals. Registration happens through DriverManager::extend(), which you call once from a service provider during application boot.
The DriverInterface contract
Every driver — built-in or custom — must implement two methods:log(LogEntry $entry): void— called once for every auditable event. Receive the fully-populatedLogEntryvalue object and send it wherever your driver needs it.prune(): int— called whenmodel-scribe:pruneruns. Return the number of records deleted. Drivers that do not manage their own storage should return0.
Building a custom driver
The example below implements a webhook driver thatPOSTs every audit entry to
a configurable URL. The constructor receives the driver’s config array directly,
so any keys you define in config/model-scribe.php are available at
$this->config.
Registering the driver
CallDriverManager::extend() inside the boot() method of any service
provider. The closure receives the driver’s config array and the DriverManager
instance, and must return a DriverInterface implementation.
extend() returns the DriverManager instance (static), so multiple drivers
can be registered fluently:
Adding the driver to your config
Once registered, the driver is available by the name you passed toextend().
Add a matching entry to the drivers map in config/model-scribe.php:
driver are forwarded verbatim to your constructor’s
$config array, so you can expose as many options as your implementation needs.
Flushing resolved driver instances
DriverManager caches resolved driver instances so they are only constructed
once per request. In tests that register drivers or swap config values between
cases, call flush() to clear the cache and force fresh construction:
MODEL_SCRIBE_DRIVER routes
entries to the correct backend.
extend() returns static (the DriverManager instance), enabling method
chaining when you need to register several custom drivers in one call. The
registration is stored immediately; you do not need to call any further
methods to activate the driver.