PHPackages                             sharpapi/laravel-ecommerce-thank-you-email - 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. [API Development](/categories/api)
4. /
5. sharpapi/laravel-ecommerce-thank-you-email

ActiveLibrary[API Development](/categories/api)

sharpapi/laravel-ecommerce-thank-you-email
==========================================

AI Thank You Email Generator for Laravel powered by SharpAPI.com

v1.0.3(1mo ago)00MITPHPPHP ^8.1

Since Jan 9Pushed 1mo agoCompare

[ Source](https://github.com/sharpapi/laravel-ecommerce-thank-you-email)[ Packagist](https://packagist.org/packages/sharpapi/laravel-ecommerce-thank-you-email)[ Docs](https://github.com/sharpapi/laravel-ecommerce-thank-you-email)[ RSS](/packages/sharpapi-laravel-ecommerce-thank-you-email/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (6)Versions (5)Used By (0)

[![SharpAPI GitHub cover](https://camo.githubusercontent.com/82bb36706c1e71276b3dca4ec9120353bb51c8f22bb62543bf056db5c28da36d/68747470733a2f2f73686172706170692e636f6d2f73686172706170692d6769746875622d6c61726176656c2d62672e6a7067 "SharpAPI Laravel Client")](https://camo.githubusercontent.com/82bb36706c1e71276b3dca4ec9120353bb51c8f22bb62543bf056db5c28da36d/68747470733a2f2f73686172706170692e636f6d2f73686172706170692d6769746875622d6c61726176656c2d62672e6a7067)

AI Thank You Email Generator for Laravel
========================================

[](#ai-thank-you-email-generator-for-laravel)

🚀 Leverage AI API to generate personalized thank you emails for E-commerce applications.
----------------------------------------------------------------------------------------

[](#-leverage-ai-api-to-generate-personalized-thank-you-emails-for-e-commerce-applications)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b40781170816110d4aaf7f6ba0a10ea02aeeb0e55a9e5b1b39c9445f3a89982d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73686172706170692f6c61726176656c2d65636f6d6d657263652d7468616e6b2d796f752d656d61696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sharpapi/laravel-ecommerce-thank-you-email)[![Total Downloads](https://camo.githubusercontent.com/f7c0cb116503a916c41882bde3090659cbb6684e698a145487007bc41e0a3d49/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73686172706170692f6c61726176656c2d65636f6d6d657263652d7468616e6b2d796f752d656d61696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sharpapi/laravel-ecommerce-thank-you-email)

Check the details at SharpAPI's [E-commerce API](https://sharpapi.com/en/catalog/ai/e-commerce) page.

---

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Laravel &gt;= 10.48.29

---

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

[](#installation)

Follow these steps to install and set up the SharpAPI Laravel Thank You Email Generator package.

1. Install the package via `composer`:

```
composer require sharpapi/laravel-ecommerce-thank-you-email
```

2. Register at [SharpAPI.com](https://sharpapi.com/) to obtain your API key.
3. Set the API key in your `.env` file:

```
SHARP_API_KEY=your_api_key_here
```

4. **\[OPTIONAL\]** Publish the configuration file:

```
php artisan vendor:publish --tag=sharpapi-ecommerce-thank-you-email
```

---

Key Features
------------

[](#key-features)

- **AI-Powered Thank You Email Generation**: Efficiently create personalized thank you emails for your e-commerce platform.
- **Multi-language Support**: Generate thank you emails in multiple languages.
- **Customizable Length**: Control the length of the generated thank you email.
- **Voice Tone Control**: Set your preferred writing style for the thank you email.
- **Context-Aware Generation**: Provide additional context to improve email relevance.
- **Robust Polling for Results**: Polling-based API response handling with customizable intervals.
- **API Availability and Quota Check**: Check API availability and current usage quotas with SharpAPI's endpoints.

---

Usage
-----

[](#usage)

You can inject the `EcommerceThankYouEmailService` class to access thank you email generation functionality. For best results, especially with batch processing, use Laravel's queuing system to optimize job dispatch and result polling.

### Basic Workflow

[](#basic-workflow)

1. **Dispatch Job**: Send product name to the API using `generateThankYouEmail`, which returns a status URL.
2. **Poll for Results**: Use `fetchResults($statusUrl)` to poll until the job completes or fails.
3. **Process Result**: After completion, retrieve the results from the `SharpApiJob` object returned.

> **Note**: Each job typically takes a few seconds to complete. Once completed successfully, the status will update to `success`, and you can process the results as JSON, array, or object format.

---

### Controller Example

[](#controller-example)

Here is an example of how to use `EcommerceThankYouEmailService` within a Laravel controller:

```
