amrlotfy / laravel-ai-smart-reply
Smart, multilingual AI-powered reply generator for any CRM / ERP / Support system built with Laravel. Supports OpenAI and OpenRouter, with Arabic and English responses.
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/amrlotfy/laravel-ai-smart-reply
Requires
- php: ^8.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0|^12.0
README
by Amr Lotfy
Smart, multilingual AI-powered reply generator for any CRM / ERP / Support system built with Laravel.
Supports OpenAI and OpenRouter, with Arabic and English responses.
โ๏ธ Features
- ๐งฉ Provider-based architecture (OpenAI, OpenRouter)
- ๐ Language support: Arabic / English / Both
- ๐ฌ Customizable AI prompt templates
- โก Plug & play: Works with any CRM, ERP, or Ticket System
- ๐ชถ Lightweight & extendable โ easy to add new providers
๐ฆ Installation
You can install the package via Composer:
composer require amrlotfy/laravel-ai-smart-reply
If Laravel does not auto-discover the provider, you can manually register it in
config/app.php
:
'providers' => [ AmrLotfy\AiSmartReply\AiSmartReplyServiceProvider::class, ],
Then publish the configuration file:
php artisan vendor:publish --provider="AmrLotfy\AiSmartReply\AiSmartReplyServiceProvider" --tag=config
โ๏ธ Configuration
Set your environment variables in .env
:
AI_SMART_REPLY_PROVIDER=openai
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4o-mini
OPENROUTER_API_KEY=sk-...
OPENROUTER_MODEL=gpt-4-turbo
AI_SMART_REPLY_LANG=both
๐ง Usage Example
use AmrLotfy\AiSmartReply\Services\AiReply; // English $reply = AiReply::generate( message: 'Customer: My payment failed', context: 'CRM Ticket #552', lang: 'en' ); echo $reply; // Arabic $reply = AiReply::generate( message: 'ุงูุนู ูู ูุงู ุฅู ุงูุฏูุน ูุดู', context: 'ุชุฐูุฑุฉ ุฑูู 552', lang: 'ar' ); echo $reply;
๐งฉ Configuration File Overview
config/ai-smart-reply.php
:
return [ 'default' => 'openai', // or openrouter 'language' => 'both', // en | ar | both 'providers' => [ 'openai' => [...], 'openrouter' => [...], ], 'templates' => [ 'default' => [ 'en' => "You are a helpful support assistant. Context: {context}. Message: {message}", 'ar' => "ุฃูุช ู ุณุงุนุฏ ุฏุนู ููู. ุงูุณูุงู: {context}. ุงูุฑุณุงูุฉ: {message}", ], ], ];
๐งฑ Extend It
To add another provider, just create a class implementing:
AmrLotfy\AiSmartReply\Providers\AiProviderInterface
and register it in config/ai-smart-reply.php
.
๐งช Coming Soon (v1.1)
- ๐ง Reply caching
- ๐ Retry & Rate Limit handling
- ๐ฌ Streaming responses
- ๐งช Unit Tests
- โ๏ธ Queue support
๐งโ๐ป Author
Amr Lotfy
- ๐ผ LinkedIn
- ๐ง amrlotfy07@gmail.com
- ๐งฐ Laravel Developer | AI Automation Expert | Instructor
๐ License
MIT License ยฉ 2025 Amr Lotfy