Download the PHP package wcflabs/ai-ledger without Composer

On this page you can find all versions of the php package wcflabs/ai-ledger. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ai-ledger

AI Ledger for Laravel

A Telescope-like monitoring dashboard for Laravel AI SDK interactions. Logs agent invocations, tool calls, token usage, costs, and latency — with a built-in web dashboard and support for MCP server/client tracing.

Tests Latest Version PHP ^8.3 Laravel ^12.0

Features


Requirements


Installation

1. Install via Composer

2. Publish the configuration

This creates config/ai-ledger.php.

3. Publish and register the authorization provider

This copies AiLedgerApplicationServiceProvider into app/Providers/. Register it in bootstrap/providers.php:

4. Publish and run the migrations


Dashboard

Once installed, the dashboard is available at /ai-ledger (configurable via dashboard.path in the config).

Authentication:

By default, the dashboard is accessible in the local environment only. For production access, open app/Providers/AiLedgerApplicationServiceProvider.php and add authorized email addresses to the viewAiLedger gate:

You can also provide a fully custom auth callback anywhere (e.g., in a service provider):


Configuration

All options live in config/ai-ledger.php.

Key Default Description
enabled true Master switch. Set AI_LEDGER_ENABLED=false to disable all recording.
driver "database" Storage driver: "database" or "file". Env: AI_LEDGER_DRIVER.
drivers.database.connection null Database connection name. Env: AI_LEDGER_DB_CONNECTION. Uses the default connection when null.
drivers.file.path storage/logs/ai-ledger Directory for file-driver JSON logs.
dashboard.enabled true Whether to register the dashboard routes.
dashboard.path "ai-ledger" URL prefix for the dashboard.
dashboard.middleware ["web"] Middleware applied to all dashboard routes.
pruning.enabled true Whether to schedule automatic daily pruning. Env: AI_LEDGER_PRUNING_ENABLED.
pruning.days 30 Number of days of records to retain. Env: AI_LEDGER_PRUNING_DAYS.
recording.prompt_text true Store the full prompt sent to the model.
recording.response_text true Store the full response from the model.
recording.tool_arguments true Store tool call input arguments.
recording.tool_results true Store tool call results.
recording.max_prompt_length null Truncate stored prompts to this many characters (null = no limit).
recording.max_response_length null Truncate stored responses to this many characters (null = no limit).
recording.max_tool_result_length 5000 Truncate stored tool results to this many characters.
recording.instructions false Store the agent's instructions() output as the invocation's system_prompt. Disabled by default to avoid growing existing installs.
recording.messages false Store the serialized conversation history ([{role, content}]) for agents implementing Laravel\Ai\Contracts\Conversational. Binary/attachment payloads are dropped; only metadata markers are kept. Disabled by default.
recording.max_instructions_length null Truncate stored instructions to this many characters (null = no limit).
pricing (see config) USD-per-million-token pricing table keyed by provider and model name.

Storage Drivers

database (default)

Stores invocations and tool calls in two database tables (ai_ledger_invocations, ai_ledger_tool_calls). Supports full filtering, aggregation, and the metrics dashboard.

file

Writes one JSON file per invocation to storage/logs/ai-ledger/. Intended for local development only — it does not support filtering events, dashboard aggregation, or the metrics chart. No migrations required.


Tagging Invocations

Tags appear in the dashboard and can be used to categorize invocations by feature, user type, or any other dimension.

Declarative — #[Tag] attribute

Apply the #[Tag] attribute to any Agent or Tool class:

Programmatic — AiLedger::tag()

Call AiLedger::tag() before the invocation runs. Tags are flushed and attached to the next recorded invocation:


Suppressing Logging

Wrap any code block with AiLedger::withoutLogging() to prevent it from being recorded:


MCP Integration

Requires laravel/mcp to be installed.

MCP calls are logged automatically — no manual setup required.

Manual decorator (advanced)

If you call an MCP client directly outside of a Laravel AI agent context, you can opt in to logging via LoggingMcpClientDecorator:

All other methods on the underlying client are proxied transparently via __call.


Filtering

You can prevent individual invocations or tool calls from being stored by listening to the filtering events and returning false.

Skip an invocation

Skip a tool call

Returning false from the listener skips storage but still executes the agent or tool normally.


Artisan Commands

Command Description
php artisan ai-ledger:status Show driver, total invocation count, oldest record, and pruning configuration.
php artisan ai-ledger:prune [--days=N] Delete records older than N days (defaults to pruning.days from config).
php artisan ai-ledger:clear [--force] Delete all AI Ledger records. Prompts for confirmation unless --force is passed.

Pruning

When pruning.enabled is true, the package automatically schedules ai-ledger:prune to run daily via the Laravel scheduler (callAfterResolving). No manual scheduler entry is required.

To override the retention period at runtime:


License

MIT — see LICENSE.


All versions of ai-ledger with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/console Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/events Version ^12.0|^13.0
illuminate/routing Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
laravel/ai Version ^0.8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wcflabs/ai-ledger contains the following files

Loading the files please wait ...