PHPackages                             norbek/aivent - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. norbek/aivent

ActiveLibrary

norbek/aivent
=============

Universal AI Suite for Laravel — connect OpenAI, DeepSeek, Gemini, and Ollama with one clean API.

v1.0.6(6mo ago)059MITPHPPHP &gt;=8.1

Since Oct 12Pushed 6mo agoCompare

[ Source](https://github.com/hamidovnorbek/aivent)[ Packagist](https://packagist.org/packages/norbek/aivent)[ RSS](/packages/norbek-aivent/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (4)Used By (0)

🤖 Aivent — Universal AI for Laravel
===================================

[](#-aivent--universal-ai-for-laravel)

 **One elegant API for OpenAI, DeepSeek, Gemini, and Ollama.**

 [![](https://camo.githubusercontent.com/74dfb6e3955e3def71c4666c9c61cee353a6b69eabb42ce669d8c458cf04d025/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f7262656b2f616976656e743f636f6c6f723d253233666632643230266c6162656c3d5061636b6167697374266c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/norbek/aivent) [![](https://camo.githubusercontent.com/acb9352f5bc960cbd7e99b178fd09d44660ea8cde13958f7a31b3623a0e7df11/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f68616d69646f766e6f7262656b2f616976656e742f74657374732e796d6c3f6c6162656c3d5465737473266c6f676f3d676974687562)](https://github.com/hamidovnorbek/aivent/actions) [![](https://camo.githubusercontent.com/62a95f9ca2f7f3894cf4c5e6549b79adb265baf88d38a5e5a71f8a273f0ab138/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f68616d69646f766e6f7262656b2f616976656e743f7374796c653d736f6369616c)](https://github.com/hamidovnorbek/aivent) [![](https://camo.githubusercontent.com/70557580565cbb4f53d73f2eaf60fbd9d34cffb919275ea7a3b7922b60fa03b6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253230253743253230313125323025374325323031322d6f72616e67653f6c6f676f3d6c61726176656c)](https://camo.githubusercontent.com/70557580565cbb4f53d73f2eaf60fbd9d34cffb919275ea7a3b7922b60fa03b6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3130253230253743253230313125323025374325323031322d6f72616e67653f6c6f676f3d6c61726176656c) [![](https://camo.githubusercontent.com/d1aa1dc9260649e859695872ab318562f3fc9086081e886647908395b4e4a4f7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e322d626c75653f6c6f676f3d706870)](https://camo.githubusercontent.com/d1aa1dc9260649e859695872ab318562f3fc9086081e886647908395b4e4a4f7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e322d626c75653f6c6f676f3d706870) [![](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)

---

Aivent provides a clean, unified AI layer for Laravel. Connect to OpenAI, DeepSeek, Gemini, and Ollama with a single API and effortless provider switching, caching, and logging.

- Simple methods: `chat()`, `summarize()`, `translate()`
- Automatic provider fallback and switching
- Cache and log out of the box
- Facade and helper functions
- CLI tools for diagnostics and maintenance

🚀 Features
----------

[](#-features)

- Multiple AI providers: OpenAI, DeepSeek, Gemini, Ollama
- Facade and helpers (`Aivent::chat()`, `aivent_chat()`)
- Automatic provider switching (fallback sequence)
- Caching of repeated prompts
- Logging with latency tracking (ms)
- Artisan CLI: `aivent:ping`, `aivent:log`, `aivent:log:clear`, `aivent:cache:clear`
- Laravel 10, 11, 12+ support
- MIT Licensed

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require norbek/aivent
```

Publish configuration:

```
php artisan vendor:publish --tag=aivent-config
```

Set your environment variables for the providers you plan to use:

```
# General
AI_PROVIDER={openai, deepseek, gemini, ollama}

# OpenAI
OPENAI_API_KEY=your-openai-key
OPENAI_BASE=https://api.openai.com/v1
OPENAI_MODEL=gpt-4o-mini

# DeepSeek
DEEPSEEK_API_KEY=your-deepseek-key
DEEPSEEK_BASE=https://api.deepseek.com/v1/chat/completions
DEEPSEEK_MODEL=deepseek-chat

# Gemini
GEMINI_API_KEY=your-gemini-key
GEMINI_BASE=https://generativelanguage.googleapis.com/v1beta
GEMINI_MODEL=gemini-1.5-flash

# Ollama (local)
OLLAMA_BASE=http://127.0.0.1:11434
OLLAMA_MODEL=llama3.1
```

\#Example

```
    'default' => env('AI_PROVIDER', 'deepseek'),

    'providers' => [
        'openai' => [
            'api_key' => env('OPENAI_API_KEY'),
            'base_url' => env('OPENAI_BASE', 'https://api.openai.com/v1'),
            'model' => env('OPENAI_MODEL', 'gpt-4o-mini'),
        ],
        'deepseek' => [
            'api_key' => env('DEEPSEEK_API_KEY'),
            'base_url' => env('DEEPSEEK_BASE', 'https://api.deepseek.com/v1/chat/completions'),
            'model' => env('DEEPSEEK_MODEL', 'deepseek-chat'),
        ],
        'gemini' => [
            'api_key' => env('GEMINI_API_KEY'),
            'base_url' => env('GEMINI_BASE', 'https://generativelanguage.googleapis.com/v1beta'),
            'model' => env('GEMINI_MODEL', 'gemini-1.5-flash'),
        ],
        'ollama' => [
            'base_url' => env('OLLAMA_BASE', 'http://127.0.0.1:11434'),
            'model' => env('OLLAMA_MODEL', 'llama3.1'),
        ],
    ],
];

```

---

⚙️ Configuration
----------------

[](#️-configuration)

🏁 Quick Start
-------------

[](#-quick-start)

```
use Norbek\Aivent\Facades\Aivent;

// Simple chat
$response = Aivent::chat('Write a short haiku about Laravel.');

// Summarize
$summary = Aivent::summarize($longText);

// Translate to English
$en = Aivent::translate('Bonjour tout le monde', 'en');
```

Helper functions:

```
$text = aivent_chat('Tell me a joke.');
$sum  = aivent_summarize($article);
$tr   = aivent_translate('Hola', 'en');
```

---

💬 Usage
-------

[](#-usage)

### Facade

[](#facade)

```
$summary = Aivent::summarize($veryLongText, [
    'model' => 'gemini-1.5-flash',
    'max_tokens' => 512,
]);
```

```
$it = Aivent::translate('Good morning', 'it', [
    'temperature' => 0.1,
]);
```

### Helper functions

[](#helper-functions)

```
$result = aivent_chat('What is the capital of Uzbekistan?');
```

### Force a specific provider

[](#force-a-specific-provider)

```
use Norbek\Aivent\Facades\Aivent;

$out = Aivent::withProvider('deepseek')
    ->chat('Give me 3 refactoring tips for Laravel controllers.');
```

Provider names: `openai`, `deepseek`, `gemini`, `ollama`.

---

🛠 Console Commands
------------------

[](#-console-commands)

- Ping all providers and show status + latency:

```
php artisan aivent:ping
```

- Show recent Aivent logs:

```
php artisan aivent:log --lines=100
```

- Clear Aivent logs:

```
php artisan aivent:log:clear
```

- Clear Aivent cached prompts:

```
php artisan aivent:cache:clear
```

Each command uses friendly tables or output for quick diagnostics.

---

Feature — Analyser: validation date of any documents / Anlyser: hujjatdagi sanani tekshirish
--------------------------------------------------------------------------------------------

[](#feature--analyser-validation-date-of-any-documents--anlyser-hujjatdagi-sanani-tekshirish)

Aivent includes an "Analyser" feature that extracts text from certificates/documents (OCR) and validates issue/expiry dates. Below is a ready-to-paste README section you can insert into the Features area of your repository.

### Overview / Umumiy ma'lumot

[](#overview--umumiy-malumot)

This feature uses Tesseract OCR + Imagick to extract text from PDFs and images, then validates dates (issued\_at / expires\_at) and other fields. It is meant for certificate verification workflows (e.g., IELTS, CEFR, etc.).

Ushbu bo'lim Tesseract OCR va Imagick dan foydalanib hujjatlardan matn olib, sanalarni tekshiradi (berilgan va muddati tugash sanalari).

---

### 3️⃣ — Install required system packages (OCR dependencies) / OCR uchun tizim paketlarini o'rnatish

[](#3️⃣--install-required-system-packages-ocr-dependencies--ocr-uchun-tizim-paketlarini-ornatish)

Aivent sertifikatdan matn olish uchun Tesseract OCR va Imagick dan foydalanadi.

🧠 Step A: Install Tesseract

```
sudo apt update
sudo apt install tesseract-ocr -y
```

🇺🇸 Step B: English and Uzbek OCR languages

```
sudo apt install tesseract-ocr-eng -y
sudo apt install tesseract-ocr-uzb -y
# yoki to'liq:
sudo apt install tesseract-ocr-all -y
```

Check available languages:

```
tesseract --list-langs
```

Expected result: eng and uzb should appear.

🖼 Step C: PDF Support (Imagick)

```
sudo apt install php-imagick -y
# restart PHP-FPM if needed, example for PHP 8.4:
sudo service php8.4-fpm restart
```

Verify Imagick:

```
php -m | grep imagick
```

If imagick is shown, it's ready.

---

### 4️⃣ — Configure cache (for AI responses) / Kesh konfiguratsiyasi

[](#4️⃣--configure-cache-for-ai-responses--kesh-konfiguratsiyasi)

Aivent AI javoblarni kechiktirmaslik uchun cache ishlatadi. .env faylingizga quyidagilarni qo'shing:

```
CACHE_DRIVER=file
AIVENT_CACHE_ENABLED=true
AIVENT_CACHE_TTL=21600
```

Bu shuni anglatadi: AI javoblar storage/framework/cache/data papkada 6 soat (21600 soniya) saqlanadi.

---

### 5️⃣ — Place your certificate files / Sertifikat fayllarini joylashtirish

[](#5️⃣--place-your-certificate-files--sertifikat-fayllarini-joylashtirish)

Masalan:

- public papkada:
    - /public/certificates/ielts.pdf
    - /public/certificates/cefr.jpg

yoki storage ichida:

- /storage/app/public/certificates/ielts.pdf

Make sure files are accessible by your app (symlink storage: php artisan storage:link if using storage/public).

---

### 6️⃣ — Use Aivent in your code / Kodda foydalanish

[](#6️⃣--use-aivent-in-your-code--kodda-foydalanish)

Example #1: Quick test route

```
use Norbek\Aivent\Facades\Aivent;

Route::get('/check-certificate', function () {
    $result = Aivent::validateCertificate('certificates/ielts.pdf');
    return response()->json($result->toArray());
});
```

Example #2: In a Controller

```
use Norbek\Aivent\Facades\Aivent;

class CertificateController extends Controller
{
    public function verify()
    {
        $result = Aivent::validateCertificate('certificates/cefr.pdf', 'public');

        if (! $result->isValid()) {
            return response()->json([
                'status' => 'failed',
                'errors' => $result->errors,
            ]);
        }

        return response()->json([
            'status' => 'success',
            'data' => $result->toArray(),
        ]);
    }
}
```

- validateCertificate accepts a path (relative to disk root) and optional disk (e.g., 'public').
- The returned object includes boolean isValid(), errors array, recognized ocr\_text, and parsed dates.

---

### 7️⃣ — Example Output / Misol chiqishi

[](#7️⃣--example-output--misol-chiqishi)

```
{
  "valid": true,
  "name": "HOMIDOV NORGE",
  "issued_at": "2023-11-25",
  "expires_at": "2025-11-25",
  "errors": [],
  "ocr_text": "Test Report Form ACADEMIC ... (OCR text)"
}
```

---

Notes / Eslatma

- Ensure provider keys and cache are configured before running heavy OCR+AI jobs.
- If OCR fails to detect certain languages, verify Tesseract language packs and try improving image quality (dpi, contrast).
- Consider rate-limiting and queueing long-running certificate verifications (use Laravel queues).

---

Paste this section into the "Features" area of your README where you keep descriptive feature blocks. If you want, I can:

- integrate this exactly into your repository README and open a PR, or
- replace any function/class placeholders (like validateCertificate) with exact names from your code after I inspect the repo.

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please:

- Fork the repo
- Create a feature branch
- Add tests when possible
- Open a pull request with a clear description and screenshots/logs if relevant

---

🔒 Security
----------

[](#-security)

If you discover a security vulnerability, please email the maintainer privately instead of using the issue tracker.

- Never commit API keys or secrets.
- Rotate and scope provider keys appropriately.

---

📄 License
---------

[](#-license)

MIT License. See the [LICENSE](LICENSE) file for details.

---

🙏 Credits
---------

[](#-credits)

- Built and maintained by [@hamidovnorbek](https://github.com/hamidovnorbek)
- Inspired by the clean package design culture of the Laravel and Spatie ecosystems

Happy building! 🚀

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance66

Regular maintenance activity

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

3

Last Release

208d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/443c6586ba13756aacf8d6a0388d74f74f4186617e05235ed422336a83fd5042?d=identicon)[norbekhamiodov](/maintainers/norbekhamiodov)

---

Top Contributors

[![hamidovnorbek](https://avatars.githubusercontent.com/u/103917967?v=4)](https://github.com/hamidovnorbek "hamidovnorbek (4 commits)")

### Embed Badge

![Health badge](/badges/norbek-aivent/health.svg)

```
[![Health](https://phpackages.com/badges/norbek-aivent/health.svg)](https://phpackages.com/packages/norbek-aivent)
```

###  Alternatives

[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[stechstudio/laravel-zipstream

A fast and simple streaming zip file downloader for Laravel.

4633.7M3](/packages/stechstudio-laravel-zipstream)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[spatie/laravel-export

Create a static site bundle from a Laravel app

646127.9k5](/packages/spatie-laravel-export)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
