PHPackages                             sfolador/ai-email-suggest - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. sfolador/ai-email-suggest

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

sfolador/ai-email-suggest
=========================

This package helps user to fix typos in email addresses by using openai api to suggest a valid email address.

1.0.10(3y ago)521[2 PRs](https://github.com/sfolador/ai-email-suggest/pulls)MITPHPPHP ^8.1

Since Jan 29Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sfolador/ai-email-suggest)[ Packagist](https://packagist.org/packages/sfolador/ai-email-suggest)[ Docs](https://github.com/sfolador/ai-email-suggest)[ RSS](/packages/sfolador-ai-email-suggest/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (11)Versions (14)Used By (0)

[![](https://camo.githubusercontent.com/a168f73340a999e7f78fd8fd5b2831eca30eba769d56f1ecb3ca410048f37829/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4169456d61696c537567676573742e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d73666f6c61646f7225324661692d656d61696c2d73756767657374267061747465726e3d617263686974656374267374796c653d7374796c655f32266465736372697074696f6e3d50726576656e742b7479706f732b696e2b757365722b656d61696c2b616464726573736573266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667267769647468733d34353026686569676874733d373530)](https://camo.githubusercontent.com/a168f73340a999e7f78fd8fd5b2831eca30eba769d56f1ecb3ca410048f37829/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4169456d61696c537567676573742e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d73666f6c61646f7225324661692d656d61696c2d73756767657374267061747465726e3d617263686974656374267374796c653d7374796c655f32266465736372697074696f6e3d50726576656e742b7479706f732b696e2b757365722b656d61696c2b616464726573736573266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667267769647468733d34353026686569676874733d373530)

[![Latest Version on Packagist](https://camo.githubusercontent.com/30d771b4b637c99313a8afb2f84df960501ede371024d4606df33c8f1b1d5b46/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73666f6c61646f722f61692d656d61696c2d737567676573742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sfolador/ai-email-suggest)[![GitHub Tests Action Status](https://camo.githubusercontent.com/d051b490a2f50bec23df147af4d2a2d03737d4a495e9c61e23fc32f53672cfaa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73666f6c61646f722f61692d656d61696c2d737567676573742f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/sfolador/ai-email-suggest/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/0ad88091feb37af6093522a04f7694a9ca424e3f05dcc2dd3cb705c77c1368dc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f73666f6c61646f722f61692d656d61696c2d737567676573742f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/sfolador/ai-email-suggest/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/3bc63a67dde3aca7fa553cc4691ddf3906943726c86c59c0207ab98e6a35430c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73666f6c61646f722f61692d656d61696c2d737567676573742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sfolador/ai-email-suggest)

Never worry about typos in email addresses in Laravel
=====================================================

[](#never-worry-about-typos-in-email-addresses-in-laravel)

This package provides a simple way to suggest email addresses based on a given email address. The typical use case is when a user enters an email address with typos, i.e.: . This package uses OpenAI to suggest an email addresses that are likely to be correct.

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

[](#installation)

You can install the package via composer:

```
composer require sfolador/ai-email-suggest
```

You can publish the config file with:

```
php artisan vendor:publish --tag="ai-email-suggest-config"
```

This is the contents of the published config file:

```
return [
    'model' => 'text-davinci-003',
    'openai_key' => env('OPENAI_KEY'),
    'default_route' => 'ai-email-suggest',
    'use_cache' => true,
    // If you want to use the chatgpt API,
    // you need to set the following value to true:
    'use_chatgpt_api' => false,
    'throttle' => [
        'enabled' => false,
        'max_attempts' => 60,
        'prefix' => 'ai-email-suggest',
    ],
];
```

*Remember to set your OpenAI key in your .env file.*

Usage
-----

[](#usage)

```
$aiEmailSuggest = AiEmailSuggest::suggest('test@yaohh.com');
// $aiEmailSuggest = 'test@yahoo.com'
```

It's possible to use this package from the frontend by invoking the route: "/ai-email-suggest" in POST by passing the email as a parameter. The response will be a JSON with the suggested email, such as:

```
{
  "suggestion": "test@yahoo.com"
}
```

Cache clear
-----------

[](#cache-clear)

If you use a Cache driver that supports tags, you can clear the cache by invoking the command:

```
php artisan ai-email-suggest:clear-cache
```

ChatGTP
-------

[](#chatgtp)

You can use the new ChatGPT API by setting the config value `use_chatgpt_api` to `true`.

Testing
-------

[](#testing)

```
composer test
```

TODO
----

[](#todo)

- Add caching to avoid too many requests to OpenAI
- Add throttling to avoid too many requests to OpenAI
- Add support for cache clear

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [sfolador](https://github.com/sfolador)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 78.9% 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 ~1 days

Total

11

Last Release

1187d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54c6b8884e3bd4e86d26de024ca07094728adc7db2a8a483538222121b00f9f1?d=identicon)[sfolador](/maintainers/sfolador)

---

Top Contributors

[![sfolador](https://avatars.githubusercontent.com/u/36632?v=4)](https://github.com/sfolador "sfolador (56 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")

---

Tags

emaillaravelopenaiphpsuggestionslaravelemailopenaisfoladorai-email-suggest

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/sfolador-ai-email-suggest/health.svg)

```
[![Health](https://phpackages.com/badges/sfolador-ai-email-suggest/health.svg)](https://phpackages.com/packages/sfolador-ai-email-suggest)
```

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[xammie/mailbook

Laravel Mail Explorer

482458.3k1](/packages/xammie-mailbook)[wnx/laravel-sends

Keep track of outgoing emails in your Laravel application.

200427.3k](/packages/wnx-laravel-sends)[spatie/laravel-discord-alerts

Send a message to Discord

151408.0k](/packages/spatie-laravel-discord-alerts)[spatie/laravel-mailcoach-sdk

An SDK to easily work with the Mailcoach API in Laravel apps

41290.2k1](/packages/spatie-laravel-mailcoach-sdk)

PHPackages © 2026

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