PHPackages                             saurabhshukla-developer/laravel-ai-chatbot - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. saurabhshukla-developer/laravel-ai-chatbot

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

saurabhshukla-developer/laravel-ai-chatbot
==========================================

A comprehensive Laravel package for building AI agents with multiple provider support, tool management, and function calling capabilities

v1.1.1(5mo ago)8121MITPHPPHP ^8.1CI passing

Since Nov 20Pushed 5mo agoCompare

[ Source](https://github.com/saurabhshukla-developer/laravel-ai-chatbot)[ Packagist](https://packagist.org/packages/saurabhshukla-developer/laravel-ai-chatbot)[ Docs](https://github.com/saurabhshukla-developer/laravel-ai-chatbot)[ RSS](/packages/saurabhshukla-developer-laravel-ai-chatbot/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (4)Used By (0)

Laravel AI Chatbot Package
==========================

[](#laravel-ai-chatbot-package)

[![Latest Version](https://camo.githubusercontent.com/d12e5eed666829cef14d3e2f3bcf99594fc2f1018fb7f4b572b31c7bbd513f5c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f736175726162687368756b6c612d646576656c6f7065722f6c61726176656c2d61692d63686174626f74)](https://github.com/saurabhshukla-developer/laravel-ai-chatbot/releases)[![License](https://camo.githubusercontent.com/93e59a46f840f31a4dab49f5f8d4c6a6a2c07f8d48ef1226b5e9e2194a814795/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736175726162687368756b6c612d646576656c6f7065722f6c61726176656c2d61692d63686174626f74)](https://github.com/saurabhshukla-developer/laravel-ai-chatbot/blob/main/LICENSE)[![PHP Version](https://camo.githubusercontent.com/7663c9d53dc13cedaf0660a8745a7e77d2dd711257f36aa86ebce12a0600ef42/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d626c75652e737667)](https://www.php.net/)[![Laravel Version](https://camo.githubusercontent.com/2695790e42105441fbad5f92ca0da234aeaf573731d27b5f738917fa60d39132/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31302e7825323025374325323031312e7825323025374325323031322e782d7265642e737667)](https://laravel.com/)

A comprehensive Laravel package for building AI-powered chatbots and agents with support for multiple AI providers (OpenAI, Anthropic, Google AI). Features include encrypted API key management, AI agent creation with custom prompts, function calling tools, and a beautiful web interface for managing your AI infrastructure.

**Repository:**

✨ Features
----------

[](#-features)

- 🔐 **Secure API Key Management** - Encrypted storage with support for multiple providers
- 🤖 **AI Agent Builder** - Create custom AI agents with personalized prompts and configurations
- 🛠️ **Function Calling Tools** - Powerful tool system for extending AI capabilities
    - File-based tools (auto-discovered PHP classes)
    - Database-backed tools (managed via web UI)
    - Easy tool creation with artisan commands
- 🌐 **Multi-Provider Support** - OpenAI, Anthropic (Claude), and Google AI
- 💬 **Built-in Chat Interface** - Ready-to-use web UI for testing agents
- 🎨 **Beautiful Web Dashboard** - Manage keys, agents, and tools through an intuitive interface
- 🔌 **Programmatic API** - Full code integration support for Laravel applications
- 📡 **Streaming Responses** - Real-time response streaming for better UX
- ✅ **Fully Tested** - Comprehensive test suite with 51 passing tests

Installation
------------

[](#installation)

**For stable release (recommended):**

```
composer require saurabhshukla-developer/laravel-ai-chatbot:^1.1.1
```

**For development version:**

```
composer config repositories.laravel-ai-chatbot vcs https://github.com/saurabhshukla-developer/laravel-ai-chatbot
composer require saurabhshukla-developer/laravel-ai-chatbot:dev-master
```

Publish configuration and migrations:

```
php artisan vendor:publish --provider="LaravelAI\Chatbot\ChatbotServiceProvider" --tag="chatbot-config"
php artisan vendor:publish --provider="LaravelAI\Chatbot\ChatbotServiceProvider" --tag="chatbot-migrations"
php artisan migrate
```

For detailed setup instructions, see [docs/SETUP.md](docs/SETUP.md).

### Updating to Latest Version

[](#updating-to-latest-version)

If you're already using this package and want to update to version 1.1.1:

```
composer update saurabhshukla-developer/laravel-ai-chatbot
php artisan migrate
php artisan cache:clear
```

**What's New in 1.1.1:**

- Fixed tools folder-info route errors
- Enhanced documentation organization
- Comprehensive test coverage (51 tests, 100% passing)
- Professional documentation formatting

**New Feature: File-Based Tools** - Create tools by simply adding PHP files! See [docs/QUICK\_START\_TOOLS.md](docs/QUICK_START_TOOLS.md) for a 3-step guide.

📦 Installation
--------------

[](#-installation)

### Quick Install

[](#quick-install)

```
composer require saurabhshukla-developer/laravel-ai-chatbot:dev-master
php artisan vendor:publish --provider="LaravelAI\Chatbot\ChatbotServiceProvider"
php artisan migrate
```

### Detailed Installation

[](#detailed-installation)

### Step 1: Install via Composer

[](#step-1-install-via-composer)

**Stable release (recommended):**

```
composer require saurabhshukla-developer/laravel-ai-chatbot:^1.1.1
```

**Development version:**

```
# Add repository first
composer config repositories.laravel-ai-chatbot vcs https://github.com/saurabhshukla-developer/laravel-ai-chatbot

# Then require dev-master version
composer require saurabhshukla-developer/laravel-ai-chatbot:dev-master
```

### Step 2: Publish Configuration and Migrations

[](#step-2-publish-configuration-and-migrations)

```
php artisan vendor:publish --provider="LaravelAI\Chatbot\ChatbotServiceProvider" --tag="chatbot-config"
php artisan vendor:publish --provider="LaravelAI\Chatbot\ChatbotServiceProvider" --tag="chatbot-migrations"
```

### Step 3: Run Migrations

[](#step-3-run-migrations)

```
php artisan migrate
```

### Step 4: (Optional) Publish Views

[](#step-4-optional-publish-views)

If you want to customize the views:

```
php artisan vendor:publish --provider="LaravelAI\Chatbot\ChatbotServiceProvider" --tag="chatbot-views"
```

Configuration
-------------

[](#configuration)

After publishing the configuration file, you can customize it at `config/chatbot.php`:

```
return [
    'default_provider' => env('CHATBOT_DEFAULT_PROVIDER', 'openai'),

    'providers' => [
        'openai' => [
            'name' => 'OpenAI',
            'api_url' => env('OPENAI_API_URL', 'https://api.openai.com/v1'),
            'model' => env('OPENAI_MODEL', 'gpt-4'),
            // ...
        ],
        // ...
    ],

    'storage_driver' => env('CHATBOT_STORAGE_DRIVER', 'database'),

    'routes' => [
        'prefix' => env('CHATBOT_ROUTE_PREFIX', 'chatbot'),
        'middleware' => ['web'],
    ],
];
```

Usage
-----

[](#usage)

### Managing API Keys

[](#managing-api-keys)

1. Navigate to `/chatbot/api-keys` in your browser
2. Click "Add API Key"
3. Select your provider and enter your API key
4. Optionally set it as the default for that provider

### Creating AI Agents

[](#creating-ai-agents)

1. Navigate to `/chatbot/agents` in your browser
2. Click "Create Agent"
3. Fill in the agent details:
    - **Name**: A descriptive name for your agent
    - **Provider**: Choose OpenAI, Anthropic, or Google AI
    - **Model**: (Optional) Specific model to use
    - **System Prompt**: (Optional) Define the agent's behavior and personality
    - **Tools**: (Optional) Select tools that the agent can use
4. Save the agent

### Creating Tools

[](#creating-tools)

#### Method 1: File-Based Tools (Recommended - Easiest!)

[](#method-1-file-based-tools-recommended---easiest)

**Super Easy - Use Artisan Command:**

```
php artisan chatbot:make-tool Calculator
```

That's it! Edit `app/Tools/CalculatorTool.php` and customize it.

**Or create manually** - Create PHP files in `app/Tools/` directory:

```
