Download the PHP package livenetworks/ln-ai-bridge without Composer

On this page you can find all versions of the php package livenetworks/ln-ai-bridge. 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 ln-ai-bridge

LN AI Bridge

AI provider abstraction layer for Laravel. Unified interface for Claude, OpenAI, and custom providers — direct Guzzle HTTP, no external SDKs.

Installation

Configuration

Add to your .env:

Quick Start

Single request

With context injection

Context pairs are injected as XML tags into the prompt:

Explicit provider

Conversations

Multi-turn conversations with persistent history, automatic summarization, and usage tracking:

All messages are persisted to the database. History is automatically loaded and included with each request.

Manual history (without ConversationManager)

For apps that manage their own message storage:

Conversation with context binding

Summarization

When a conversation exceeds the configured message threshold, older messages are automatically summarized via an AI call. The summary replaces the old messages in context, keeping the conversation within token limits.

Configure in config/ai-bridge.php:

Tool Use (Function Calling)

The AI can request data from the backend via tools. Tool calls are executed automatically — the caller receives only the final text response.

1. Define tools in the request

2. Implement a tool executor

3. Register executors

Multiple tools in one request

Usage Tracking

Every AI request is automatically logged to ai_usage_log with input/output token counts, provider, and model. Query aggregated usage per tenant or user:

Pass tenant/user context for tracking on direct send() calls:

Disable tracking in .env:

Adding Custom Providers

1. Create the provider class extending AbstractProvider:

2. Register it in a service provider:

3. Add config to config/ai-bridge.php providers array:

Configuration Reference

Key Default Description
ai-bridge.default claude Default provider
ai-bridge.providers.claude.api_key Anthropic API key
ai-bridge.providers.claude.model claude-sonnet-4-20250514 Claude model
ai-bridge.providers.claude.base_url https://api.anthropic.com Claude API base URL
ai-bridge.providers.claude.version 2023-06-01 Anthropic API version
ai-bridge.providers.openai.api_key OpenAI API key
ai-bridge.providers.openai.model gpt-4o OpenAI model
ai-bridge.providers.openai.base_url https://api.openai.com OpenAI API base URL
ai-bridge.logging false Enable request/response logging
ai-bridge.defaults.temperature 0.4 Default temperature
ai-bridge.defaults.max_tokens 8192 Default max tokens
ai-bridge.defaults.timeout 60 HTTP timeout (seconds)
ai-bridge.conversation.summarize_threshold 20 Messages before auto-summarization
ai-bridge.conversation.keep_recent 6 Recent messages to keep unsummarized
ai-bridge.conversation.summary_max_tokens 500 Max tokens for summary
ai-bridge.usage.tracking_enabled true Enable usage tracking
ai-bridge.retry.enabled true Enable automatic retry
ai-bridge.retry.max_retries 3 Max retry attempts
ai-bridge.retry.base_delay_ms 1000 Base delay in milliseconds
ai-bridge.retry.multiplier 2 Exponential backoff multiplier
ai-bridge.retry.retryable_codes [429,500,502,503,529] HTTP status codes to retry

Retry

API requests are automatically retried on transient failures with exponential backoff. The caller receives only the final response — retries are transparent.

Configure in config/ai-bridge.php:

Disable via .env:

License

MIT License — Live Networks DOOEL.


All versions of ln-ai-bridge with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^11.0|^12.0
illuminate/database Version ^11.0|^12.0
illuminate/http Version ^11.0|^12.0
guzzlehttp/guzzle Version ^7.8
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 livenetworks/ln-ai-bridge contains the following files

Loading the files please wait ...