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

v1.0.3 2025-10-18 21:11 UTC

This package is auto-updated.

Last update: 2025-10-18 21:11:48 UTC


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

๐Ÿ“„ License

MIT License ยฉ 2025 Amr Lotfy