Download the PHP package alidaaer/laravel-ai-agent without Composer

On this page you can find all versions of the php package alidaaer/laravel-ai-agent. 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 laravel-ai-agent

Laravel AI Agent

🧠 Give your Laravel app a brain, safely.

Latest Version License PHP Version Laravel Version

Build AI Agents that execute real actions in your Laravel application with minimal code.


Laravel AI Agent is the ultimate Laravel AI package for building intelligent automation. Transform your Laravel app with AI-powered agents that can understand natural language and execute PHP methods directly. Perfect for Laravel GPT integration, AI automation, and function calling. This Laravel AI solution works with OpenAI, Anthropic Claude, Gemini, and more - making it the most flexible AI assistant for Laravel.

✨ Why Laravel AI Agent?

Feature Description
🚀 Zero Boilerplate Turn any method into an AI tool with a single attribute
🧠 Smart Auto-Inference Auto-generates descriptions and infers types from parameter names
💬 Chat Widget Beautiful, customizable Web Component - just drop it in!
🔌 Multi-Provider OpenAI, Anthropic Claude, Google Gemini, DeepSeek, OpenRouter
💾 Memory AI-powered summarization with smart pointer tracking — session or database
📊 Markdown Responses Tables, formatting, and rich text in chat
⚡ Smart Returns view(), redirect(), Model — AI understands them all
🤖 Multi-Agent Class-based agents with per-method access control
🛡️ Security Built-in Prompt injection detection, XSS prevention, secret redaction
🎯 Laravel Native Feels like part of the framework

📦 Installation

Add to your .env:

Run migrations for conversation history:


🚀 Quick Start

1. Add the Chat Widget ⚡

Drop it into any Blade view — routes are auto-registered!

Open the page, click the bubble, start talking. You already have a working AI chatbot! 🎉

All widget settings (theme, language, position, etc.) are read from config/ai-agent.php:

💡 The system_prompt is set in config (not HTML) so it stays hidden from the client.

2. Give AI Your Tools (Zero-Config!)

Place it anywhere in app/ — the package auto-discovers all #[AsAITool] methods. Now say "Add a product called iPhone for $999" and it actually does it! 🚀

🤖 Need custom agents? Create dedicated agents with php artisan make:agent — see Multi-Agent System.


💬 Chat Widget Component

A beautiful, drop-in Web Component for AI chat — with conversations, i18n, and stop button built-in.

Full-Featured Example

Or use the PHP helper directly with overrides:

All Options

Attribute Description Default
endpoint Chat API URL Required
stream Enable SSE streaming (boolean) —
history-endpoint Load conversation history + conversations sidebar —
persist-messages Keep messages across page reloads (boolean) —
theme light or dark dark
lang Language: en, ar, fr, es, zh en
rtl Right-to-left mode (boolean) Auto for ar
title Header title AI Assistant
subtitle Header subtitle —
welcome-message First bot message —
placeholder Input placeholder Type your message...
primary-color Theme color #6366f1
position bottom-right, bottom-left, top-right, top-left bottom-right
width Widget width 400px
height Widget height 600px
button-icon Floating button icon (URL or emoji) 💬
button-size Floating button size 56px

Features


🔧 Chat API

Routes are auto-registered — no setup needed! The widget works out of the box with:

Need a custom endpoint? Easy:


🛠️ Creating Tools

Zero-Config (Recommended)

With Custom Description

With Custom Parameters

The package auto-discovers parameters from type hints. But if your method uses Request or you want more control, define them manually with name:type syntax:

Supported types: string, integer, number, boolean, array. Without :type, the type is inferred from the parameter name (id → integer, price → number).

💡 When to use params? Only when auto-discovery isn't enough — e.g., dynamic Request inputs, or when you want custom descriptions for the AI.

Smart Type Inference

No type hints? We infer from names:

Parameter Name Inferred Type
$id, $productId, $userId integer
$price, $total, $amount number
$isActive, $hasItems, $enabled boolean
$items, $products, $users array
Other string

⚡ Smart Return Handling

Use your existing methods as AI tools — no refactoring needed.

The agent automatically understands any return type: view(), redirect(), Model, Collection, JsonResponse, and even catches exceptions and validation errors gracefully.

Zero-Config — It Just Works

Exceptions & Validation — Handled Automatically

isAICall() — Full Control When You Need It

Customize responses for AI vs Web with a single helper:

One method, two audiences. Web users get a Blade view, AI gets structured data.

Return Type What AI Receives
view('...', $data) The $data variables directly
redirect()->with('message', '...') {"message": "..."}
Eloquent Model model->toArray()
Collection collection->toArray()
JsonResponse The JSON data
ValidationException Error messages in user's language
Any Exception Error message for AI to report

🔌 Providers


🤖 Multi-Agent System

Create dedicated agent classes with isolated tools, permissions, and conversations.

1. Create an Agent

This generates a class in app/AI/Agents/ and auto-registers it in config/ai-agent.php.

2. Scope Tools Per Agent

Use class references for IDE autocompletion and refactor safety:

Rule: No agents param = available to all agents. Explicit list = restricted.

3. Auto-Generated Endpoints

Each agent gets its own isolated routes — automatically:

Conversations are isolated per agent — each agent sees only its own conversation history.

4. Add Widget to Blade

Each agent renders its own fully-configured widget:

Each widget automatically uses the correct endpoints, theme, language, and position defined in the agent's widgetConfig().

5. Customize Widget Appearance

6. Mobile / API Usage

No agents? Everything works without agents — use the generic /ai-agent/chat endpoint with the widget directly.


💾 Conversation Memory

Smart Memory Management:


⚙️ Configuration

📖 See Full Documentation for all configuration options.


📡 Events


📖 Full Example

That's it. Tools are auto-discovered, routes are auto-registered, conversations are isolated per agent, memory is auto-managed. 🎉


📖 Documentation

For the full detailed documentation — including all configuration options, security features, event system, streaming, and more — see documentation.md.


🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

The MIT License (MIT). See License File for more information.


Made with ❤️ for Laravel developers


All versions of laravel-ai-agent with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/validation Version ^10.0|^11.0|^12.0
illuminate/cache Version ^10.0|^11.0|^12.0
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 alidaaer/laravel-ai-agent contains the following files

Loading the files please wait ...