Download the PHP package mostafaarafat/laravel-datachat without Composer
On this page you can find all versions of the php package mostafaarafat/laravel-datachat. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-datachat
DataChat - AI-Powered Chat Widget for Laravel
Transform your Laravel database into a conversational interface! DataChat allows users to ask questions in natural language and get instant insights from your data - no SQL knowledge required.
Built on top of Laravel AI Database Assistant - Extends the powerful AI-to-SQL engine with an embeddable frontend widget.
โจ Features
- ๐ค Natural Language Queries - Ask questions in plain English
- ๐ฌ Embeddable Widget - Drop-in chat interface for any website
- ๐ Secure by Default - Row-level security, rate limiting, API key auth
- ๐จ Fully Customizable - Colors, position, suggestions, branding
- โก Real-time Responses - Asynchronous processing with queues
- ๐ Usage Analytics - Track conversations, costs, and performance
- ๐ CORS Ready - Easy cross-domain embedding
- ๐ง Multi-AI Support - Works with Anthropic Claude, OpenAI GPT-4, Google Gemini
๐ธ Screenshots
Chat Widget
Dashboard
- Widget configuration & management
- Real-time analytics & usage graphs
- Conversation history viewer
- API key management
๐ Quick Start
Requirements
- PHP 8.1 or higher
- Laravel 10.x or 11.x
- MySQL 5.7+ or PostgreSQL 10+
- Redis (recommended for queues)
- Node.js 18+ (for building widget)
- Composer 2.x
Installation
Step 1: Install via Composer
Step 2: Publish Configuration & Run Migrations
Step 3: Configure Your AI Provider
Add your AI API key to .env:
Step 4: Configure Queue (Important!)
DataChat processes messages asynchronously for better performance.
Start the queue worker:
For production, use Laravel Supervisor.
Step 5: Create Your First Widget
This interactive command will:
- Create a widget configuration
- Generate an API key
- Set up default suggested questions
- Show installation code
๐ฆ Usage
Embed Widget in Your Website
Add this code to any HTML page:
Advanced Configuration
Laravel Blade Integration
๐๏ธ Dashboard Management
Access the dashboard to manage your widgets:
Note: Dashboard requires authentication. Ensure users are logged in.
Dashboard Features
- Widget List - View all configured widgets
- Create Widget - Set up new chat interfaces
- Analytics - View usage stats and message volume
- API Keys - Generate and regenerate keys
- Conversations - Browse chat history
- Suggested Questions - Configure helpful prompts
โ๏ธ Configuration
Edit config/datachat.php:
๐ Security Features
API Key Authentication
Every widget has a unique API key. Keys can be regenerated anytime:
Or via dashboard: Widget Details โ "Regenerate Key"
Row-Level Security (User Scoping)
Restrict queries to user-specific data using metadata:
Backend Implementation:
Modify ChatService to apply scoping:
Rate Limiting
Configure per-widget limits:
- Daily limit - Total messages per 24 hours
- Per-minute limit - Prevents spam/abuse
Users receive clear error messages when limits are reached.
CORS Protection
Restrict widget usage to specific domains:
Requests from other domains will be rejected.
Strict Mode
When enabled (default), only SELECT queries are allowed. No INSERT, UPDATE, DELETE, or DROP.
๐จ Customization
Widget Appearance
Configure via dashboard or programmatically:
Suggested Questions
Add helpful prompts to guide users:
Custom Styling
Override CSS variables:
๐ Analytics & Monitoring
Usage Tracking
DataChat automatically tracks:
- Message count per day
- Estimated AI API costs
- Active conversations
- Processing times
Access via dashboard or query directly:
Conversation History
View all conversations:
Logs
All errors are logged to Laravel's log system:
๐งช Testing
Test Widget Locally
Create a test HTML file:
Test API Endpoints
Automated Tests
Run package tests:
๐ Troubleshooting
Widget Not Loading
Problem: Chat button doesn't appear
Solutions:
- Check browser console for errors
- Verify API key is correct
- Ensure JavaScript files are loaded
- Check CORS settings if embedding on external domain
Messages Not Sending
Problem: Messages appear but no response
Solutions:
- Verify queue worker is running
- Check Laravel logs for errors
- Confirm AI API key is valid
API Key Invalid Error
Problem: 401 Unauthorized errors
Solutions:
- Regenerate API key via dashboard
- Clear browser cache
- Verify key matches widget configuration
CORS Errors
Problem: "CORS policy: No 'Access-Control-Allow-Origin' header"
Solutions:
- Add domain to allowed_domains in widget settings
- Check config/datachat.php CORS settings
- Verify middleware is applied
Queue Not Processing
Problem: Messages stuck in "processing" state
Solutions:
- Restart queue worker
- Check Redis connection
- Review failed jobs
Widget Build Errors
Problem: npm run build fails
Solutions:
- Use Node 18+
- Clear npm cache
- Delete node_modules and reinstall
๐ Production Deployment
1. Environment Variables
2. Build Widget
3. Optimize Laravel
4. Set Up Supervisor
Create /etc/supervisor/conf.d/datachat-worker.conf:
Reload Supervisor:
5. CDN (Optional)
For better performance, serve widget files via CDN:
Update widget initialization:
6. SSL/HTTPS
Ensure your app is served over HTTPS for security.
7. Monitoring
Set up error tracking (e.g., Sentry, Bugsnag):
๐ Performance Optimization
Caching
Enable caching for repeated queries:
Database Indexing
Add indexes for frequently queried columns:
Queue Optimization
Use multiple workers for high traffic:
Redis Optimization
Configure Redis for queue performance:
๐ API Reference
Configuration Endpoint
Send Message
Get Conversation
Poll for New Messages
๐ค Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
Development Setup
Coding Standards
- Follow PSR-12 for PHP code
- Use ESLint for JavaScript
- Write tests for new features
- Update documentation
๐ Changelog
[1.0.0] - 2025-03-30
Added
- Initial release
- AI-powered chat widget
- Dashboard for widget management
- Real-time message polling
- Usage analytics & tracking
- Multi-AI provider support
- CORS & security features
- Queue-based processing
- Customizable appearance
- Suggested questions
- Rate limiting
๐ฃ๏ธ Roadmap
v1.1 (Q2 2025)
- [ ] WebSocket support for real-time updates
- [ ] Voice input integration
- [ ] Export conversation to PDF/CSV
- [ ] Advanced analytics dashboard
- [ ] Multi-language support
v1.2 (Q3 2025)
- [ ] Team collaboration features
- [ ] Slack/Discord bot integration
- [ ] Custom AI model training
- [ ] White-label option
- [ ] Mobile SDK (iOS/Android)
v2.0 (Q4 2025)
- [ ] GraphQL support
- [ ] Workflow automation
- [ ] Advanced user permissions
- [ ] Data visualization in chat
- [ ] Plugin system
๐ License
This package is open-sourced software licensed under the MIT license.
๐ Credits
Built by Mostafa Arafat
Powered by:
๐ฌ Support
- Documentation: https://docs.datachat.dev
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
- Twitter: @datachat
โญ Show Your Support
If you find this package helpful, please consider:
- โญ Starring the repository
- ๐ Reporting bugs
- ๐ก Suggesting features
- ๐ Writing tutorials
- ๐ฐ Sponsoring development
Made with โค๏ธ for the Laravel community
All versions of laravel-datachat with dependencies
illuminate/support Version ^8.0|^8.1|^8.2|^8.3|^8.4|^8.5|^9.0|^10.0|^11.0
illuminate/database Version ^8.0|^8.1|^8.2|^8.3|^8.4|^8.5|^9.0|^10.0|^11.0
illuminate/http Version ^8.0|^8.1|^8.2|^8.3|^8.4|^8.5|^9.0|^10.0|^11.0
mostafaarafat/laravel-ai-database Version ^1.0