PHPackages                             sabuj073/laravel-ecommerce-image-search - 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. sabuj073/laravel-ecommerce-image-search

ActiveLibrary

sabuj073/laravel-ecommerce-image-search
=======================================

Ecommerce image search using OpenAI Vision + Embeddings API for Laravel

00PHP

Since Mar 10Pushed 1w agoCompare

[ Source](https://github.com/sabuj073/ecommerce-image-search)[ Packagist](https://packagist.org/packages/sabuj073/laravel-ecommerce-image-search)[ RSS](/packages/sabuj073-laravel-ecommerce-image-search/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Ecommerce Image Search (OpenAI)
=======================================

[](#laravel-ecommerce-image-search-openai)

Ecommerce এ ইমেজ দিয়ে প্রোডাক্ট খুঁজতে OpenAI Vision + Embeddings API ব্যবহার করুন।

Installation
------------

[](#installation)

```
composer require sabuj073/laravel-ecommerce-image-search
```

```
php artisan vendor:publish --tag=ecommerce-image-search-config
```

Configuration
-------------

[](#configuration)

`.env`:

```
OPENAI_API_KEY=sk-...
OPENAI_VISION_MODEL=gpt-4o-mini
OPENAI_EMBEDDING_MODEL=text-embedding-3-small
OPENAI_EMBEDDING_DIMENSION=1536

```

Flow
----

[](#flow)

1. প্রোডাক্টগুলোর জন্য একবার **embedding** বানান (title + description দিয়ে)।
2. ইউজার ইমেজ আপলোড করলে সেই ইমেজের জন্য **Vision** দিয়ে বর্ণনা নিন, তারপর সেই বর্ণনার **embedding** নিন।
3. প্রোডাক্ট embeddings এর সাথে **cosine similarity** দিয়ে মিলিয়ে টপ রেজাল্ট দিন।

Usage
-----

[](#usage)

**ইমেজ থেকে সার্চ ভেক্টর:**

```
use Sabuj073\EcommerceImageSearch\OpenAIImageSearch;

$search = app(OpenAIImageSearch::class);
$embedding = $search->embedImageForSearch('/path/to/uploaded.jpg');
// or URL: $search->embedImageForSearch('https://example.com/image.jpg');
```

**টেক্সট থেকে embedding (প্রোডাক্ট সেভ করার সময়):**

```
$embedding = $search->embedText($product->title . ' ' . $product->description);
// Save $embedding in products table (JSON column or separate table)
```

**ইমেজ দিয়ে সরাসরি সার্চ:**

```
$products = Product::all()->map(fn ($p) => [
    'id' => $p->id,
    'name' => $p->name,
    'embedding' => $p->embedding, // array from DB
])->toArray();

$results = $search->searchByImage(request()->file('image')->getRealPath(), $products, 10);
foreach ($results as $r) {
    echo $r['product']['name'] . ' - score: ' . $r['score'];
}
```

**শুধু embedding দিয়ে সার্চ:**

```
$results = $search->searchByEmbedding($queryEmbedding, $products, 10);
```

**Cosine similarity (স্ট্যাটিক):**

```
$sim = OpenAIImageSearch::cosineSimilarity($vecA, $vecB);
```

Database
--------

[](#database)

প্রোডাক্ট টেবিলে embedding রাখতে একটা JSON/array column যোগ করুন:

```
$table->json('embedding')->nullable();
```

মাইগ্রেশন চালানোর পর প্রোডাক্ট আপডেট করার সময় `embedText()` দিয়ে embedding পেয়ে সেভ করুন।

###  Health Score

20

—

LowBetter than 17% of packages

Maintenance64

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2efefd0d96dbe26a45d6f83e670878ce6bf6f5add6bf75b32f7ac092b70a4910?d=identicon)[sabuj073](/maintainers/sabuj073)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/sabuj073-laravel-ecommerce-image-search/health.svg)

```
[![Health](https://phpackages.com/badges/sabuj073-laravel-ecommerce-image-search/health.svg)](https://phpackages.com/packages/sabuj073-laravel-ecommerce-image-search)
```

PHPackages © 2026

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