Download the PHP package schmosbyy/ai-companion without Composer
On this page you can find all versions of the php package schmosbyy/ai-companion. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download schmosbyy/ai-companion
More information about schmosbyy/ai-companion
Files in schmosbyy/ai-companion
Package ai-companion
Short Description AI Companion for your Laravel App
License proprietary
Informations about the package ai-companion
AI Companion for Laravel
Overview
AI Companion is a Laravel package that enables natural language to SQL conversion, executes queries securely, and intelligently determines whether to display results as an HTML table or Chart.js visualization.
This package is designed for developers who want AI-powered data querying within their Laravel applications while ensuring security and ease of use.
Features
✅ Convert natural language into SQL queries using a local LLM (via Ollama)
✅ Validate SQL queries to prevent SQL injection
✅ Automatically select between HTML tables and Chart.js graphs for the best visualization
✅ Provides a user-friendly /ai-home endpoint for executing queries
✅ Supports configurable AI models, API endpoints, and execution timeout
Installation
Step 1: Install via Composer
Step 2: Configure (Optional)
The package works out of the box with default configurations, but if you want to modify them, publish the config file:
This will create the file:
📄 config/ai.php
Usage
1️⃣ Start the Local LLM Server
AI Companion requires Ollama running as an API server.
Run the following command to serve the LLM:
Ensure that the required model is downloaded and available.
To check available models, run:
If the model is missing, download it with:
2️⃣ Use the AI Companion
Visit:
Here, you can enter natural language queries, and the AI will:
- Convert it into SQL
- Validate the SQL for security
- Run the query safely
- Determine the best visualization (table or graph)
3️⃣ Customizing Configurations
By default, the package uses:
If you want to change the AI model or API URL, update your .env
:
Security
🚨 SQL Injection Protection
- The package only allows SELECT queries
- It strictly validates the query before execution
- Malicious queries (INSERT, DELETE, DROP, etc.) are blocked
⚠️ Additional Best Practices
- Ensure your database permissions restrict unwanted changes
- Always validate user inputs before running AI-powered queries
License
This project is licensed under the Prosperity Public License 3.0.0.
🔹 Non-commercial use is allowed freely
🔹 Commercial use requires explicit permission
Read the full LICENSE file for details.
Credits & Attribution
This package is inspired by:
- Laravel's built-in Query Builder
- Ollama for local AI inference
🚀 Happy Querying!
All versions of ai-companion with dependencies
illuminate/http Version >=9.0
ext-json Version *
ext-pdo Version *