Download the PHP package emon/larabot-ai without Composer

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

LaraBot AI

Latest Version Total Downloads

Conversational AI database assistant for Laravel that combines Schema-RAG and NLโ†’SQL capabilities using Google Gemini AI.

๐Ÿš€ Features

๐Ÿ“‹ Requirements

๐Ÿ“ฆ Installation

Step 1: Install via Composer

Step 2: Publish Configuration

Step 3: Publish Migrations

Step 4: Configure Environment

Add to your .env file:

Get your free API key from Google AI Studio.

Step 5: Add Read-Only Database Connection

Add this to config/database.php:

Security Tip: Create a read-only MySQL user:

Then add to .env:

Step 6: Run Migrations

Step 7: Embed Your Database Schema

Interactive Selection: The command will display all available tables and let you select which ones to embed:

This command will:

Time: ~1 second per table (API rate limits: 60 requests/minute)

Example:

Step 8 (Optional): Embed Documentation

If you have markdown documentation in a docs/ directory:

๐ŸŽฏ Usage

API Endpoints

The package automatically registers these routes:

Ask Questions

Response:

๐ŸŽจ HTML Visualizations (New in v1.2.0)

The bot now intelligently generates beautiful HTML/CSS visualizations along with natural language answers!

Key Features:

Example:

Visualization Types:

Learn More:

Example Queries

SQL Queries:

Documentation Queries:

Programmatic Usage

โš™๏ธ Configuration

Authentication

By default, bot routes are publicly accessible. To require authentication:

Option 1: Environment Variables (Recommended)

Add to .env:

Option 2: Config File

Edit config/gemini.php:

Option 3: Custom Middleware (Advanced)

Edit config/gemini.php and customize the middleware array:

Testing Authenticated Requests:

Common Auth Guards:

Rate Limiting

Default: 10 requests per minute per user/IP

To customize, modify src/Http/Middleware/BotRateLimitMiddleware.php:

Query Length

Default: 500 characters max

Change in middleware:

Gemini Models

In config/gemini.php:

๐Ÿ”’ Security Features

โœ… Read-Only Database - Queries execute on separate read-only connection
โœ… SQL Injection Prevention - Blocks dangerous SQL patterns
โœ… No Mutations - DROP, DELETE, UPDATE, INSERT automatically blocked
โœ… Optional Authentication - Support for Sanctum, Passport, and custom guards
โœ… Rate Limiting - Prevents API abuse (10 req/min default)
โœ… Query Validation - Validates generated SQL before execution
โœ… Audit Logging - All queries logged with user ID and timestamps

๐Ÿงช How It Works

Architecture

Key Components

  1. Schema Embeddings - Vector representations of your database tables
  2. Semantic Search - Finds relevant tables using AI similarity matching
  3. Relationship Discovery - Automatically includes related tables via foreign keys
  4. Column-Aware Matching - Matches query terms to specific columns
  5. SQL Generation - Gemini LLM generates optimized SQL queries
  6. SQL Validation - Multi-layer security checks before execution

๐Ÿ“Š Query Logging

All queries are logged to query_logs table:

Fields: query, intent, generated_sql, retrieved_tables, response_time_ms, success, error_message

๐Ÿ”ง Maintenance

Re-embed Schema After Changes

Run this after migrations or schema changes:

Tip: You can selectively re-embed only the tables that changed by using the interactive selection.

Update Documentation

After updating docs:

๐Ÿ› Troubleshooting

"403 Forbidden" from Gemini API

Solution: Remove API key restrictions in Google AI Studio.

"429 Too Many Requests"

Solution: Hitting free tier quota limit. Wait or upgrade plan.

"Table X is not in allowed list"

Solution: Schema not embedded. Run php artisan schema:embed and select the tables you need to embed. You can use all to embed all tables or select specific ones.

SQL Validation Errors

Solution: Generated SQL contains dangerous operations or syntax errors. Check query logs.

๐Ÿ“š Documentation

๐Ÿค Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new features
  4. Submit a pull request

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ™ Credits

Built with:

๐Ÿ’ฌ Support

๐ŸŒŸ Star History

If this package helped you, please star it on GitHub! โญ


Made with โค๏ธ for the Laravel community


All versions of larabot-ai with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.5
ramsey/uuid Version ^4.7
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 emon/larabot-ai contains the following files

Loading the files please wait ...