Search by

sharpapi / laravel-ecommerce-product-description

dawid-makowski

AI Product Description Generator for Laravel powered by SharpAPI.com

Package info

github.com/sharpapi/laravel-ecommerce-product-description

pkg:composer/sharpapi/laravel-ecommerce-product-description

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-09-24 15:20 UTC

This package is auto-updated.

Last update: 2026-09-24 15:21:23 UTC


README

SharpAPI GitHub cover

AI Product Description Generator for Laravel

🚀 Leverage AI API to generate detailed product descriptions for E-commerce applications.

Latest Version on Packagist Total Downloads

Check the details at SharpAPI's E-commerce API page.

Requirements

  • PHP >= 8.1
  • Laravel >= 10.48.29

Installation

  1. Install the package via composer:
composer require sharpapi/laravel-ecommerce-product-description
  1. Register at SharpAPI.com to obtain your API key.

  2. Set the API key in your .env file:

SHARP_API_KEY=your_api_key_here
  1. [OPTIONAL] Publish the configuration file:
php artisan vendor:publish --tag=sharpapi-ecommerce-product-description

Usage

Inject EcommerceProductDescriptionService (or resolve it from the container). The call is asynchronous:

  1. generateProductDescription() submits the job and returns a status URL.
  2. fetchResults($statusUrl) polls until the job finishes and returns a SharpApiJob.
  3. Check $job->status before reading the result; a failed job does not throw.

fetchResults() can block for up to SHARP_API_JOB_STATUS_POLLING_WAIT seconds, so call it from a queued job, not in a web request.

use SharpAPI\Core\Enums\SharpApiJobStatusEnum;
use SharpAPI\EcommerceProductDescription\EcommerceProductDescriptionService;

public function handle(EcommerceProductDescriptionService $service): void
{
    $statusUrl = $service->generateProductDescription(
        'Razer Blade 16 Gaming Laptop, NVIDIA RTX 4090, Intel i9, 32GB RAM, 2TB SSD',
        language: 'English',     // optional, defaults to 'English'
        maxLength: 800,          // optional
        voiceTone: 'Professional', // optional
        context: null,           // optional extra instructions
    );

    $job = $service->fetchResults($statusUrl);

    if ($job->status === SharpApiJobStatusEnum::SUCCESS->value) {
        $result = json_decode($job->getResultJson(), true);
    }
}

Parameters

  • productData (string): product name plus as many details as you have
  • language (string|null): output language as a full name, e.g. "English" (default 'English')
  • maxQuantity (int|null): sent to the API as max_quantity
  • maxLength (int|null): length limit, sent as max_length
  • voiceTone (string|null): tone of voice, e.g. "Professional"
  • context (string|null): extra instructions for the AI

Optional Configuration

SHARP_API_KEY=your_api_key_here
SHARP_API_JOB_STATUS_POLLING_WAIT=180
SHARP_API_JOB_STATUS_USE_POLLING_INTERVAL=false
SHARP_API_JOB_STATUS_POLLING_INTERVAL=10
SHARP_API_BASE_URL=https://sharpapi.com/api/v1

AI agents (Laravel Boost)

This package ships a Laravel Boost skill, sharpapi-ecommerce-product-description, that teaches AI coding agents how to call EcommerceProductDescriptionService correctly: submit, then fetchResults() in a queued job, check the job status, and read the result. It loads on demand and adds no always-on guideline. Boost 2 or newer is required.

In the host app:

composer require laravel/boost --dev
php artisan boost:install             # first time
php artisan boost:update --discover   # already using Boost

Select sharpapi/laravel-ecommerce-product-description when Boost lists the packages it found.

Changelog

Please see CHANGELOG for a detailed list of changes.

Credits

License

The MIT License (MIT).