PHPackages                             offline-agency/laravel-email-chef - 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. offline-agency/laravel-email-chef

ActiveLibrary[API Development](/categories/api)

offline-agency/laravel-email-chef
=================================

This is a simple Laravel package for integration with Email Chef API

2.0.0(2mo ago)01574MITPHPPHP ^8.4CI passing

Since Jul 12Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/offline-agency/laravel-email-chef)[ Packagist](https://packagist.org/packages/offline-agency/laravel-email-chef)[ Docs](https://github.com/offlineagency/laravel-email-chef)[ GitHub Sponsors](https://github.com/OfflineAgency)[ RSS](/packages/offline-agency-laravel-email-chef/feed)WikiDiscussions main Synced yesterday

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

Laravel Email Chef API
======================

[](#laravel-email-chef-api)

[![Latest Stable Version](https://camo.githubusercontent.com/6b944772f1f493dff5d6e91ca352252da8d835de7b0d4a0d75e7c55d43d7f34e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f66666c696e652d6167656e63792f6c61726176656c2d656d61696c2d63686566)](https://packagist.org/packages/offline-agency/laravel-email-chef)[![PHP Version](https://camo.githubusercontent.com/b0aaccaa827dd446bbebf27b633d6e987df7808d309260ee11d9c929cbe75052/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6f66666c696e652d6167656e63792f6c61726176656c2d656d61696c2d63686566)](https://packagist.org/packages/offline-agency/laravel-email-chef)[![Tests](https://github.com/offline-agency/laravel-email-chef/actions/workflows/main.yml/badge.svg)](https://github.com/offline-agency/laravel-email-chef/actions)[![codecov](https://camo.githubusercontent.com/adc34d77b03f48ec31d8299356ded042bd23726e21a342dae6e329b3ae569d75/68747470733a2f2f636f6465636f762e696f2f67682f6f66666c696e652d6167656e63792f6c61726176656c2d656d61696c2d636865662f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/offline-agency/laravel-email-chef)![PHPStan](https://camo.githubusercontent.com/61f8d2ecf3b0c0403210fc99bb1c53f0b1ccf2da31a4c49e949a072fd7c6b3b9/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230362d626c7565)[![Total Downloads](https://camo.githubusercontent.com/6cb53813eb472dc9ae2bd15ef63de138eefdb88d7d44648b42e6dfa3583a492f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f66666c696e652d6167656e63792f6c61726176656c2d656d61696c2d63686566)](https://packagist.org/packages/offline-agency/laravel-email-chef)[![License](https://camo.githubusercontent.com/daae46b6364cedb46c95b8b9d081b489c770d548a958a50d00aaa2623b708ac9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f66666c696e652d6167656e63792f6c61726176656c2d656d61696c2d63686566)](LICENSE.md)

A Laravel package for the [EmailChef](https://emailchef.com) API — covering all 14 resource groups with a fluent, typed PHP interface.

---

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

[](#requirements)

DependencyVersionPHP^8.4Laravel^12.0 | ^13.0orchestra/testbench (dev)^10.0 | ^11.0---

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

[](#installation)

```
composer require offline-agency/laravel-email-chef
```

Publish the config file:

```
php artisan vendor:publish --provider="OfflineAgency\LaravelEmailChef\LaravelEmailChefServiceProvider" --tag="laravel-email-chef-config"
```

Add your credentials to `.env`:

```
EMAIL_CHEF_USERNAME=your@email.com
EMAIL_CHEF_PASSWORD=your-password
```

The published config (`config/email-chef.php`):

```
return [
    'baseUrl'    => 'https://app.emailchef.com/apps/api/v1/',
    'login_url'  => 'https://app.emailchef.com/api/',
    'username'   => env('EMAIL_CHEF_USERNAME'),
    'password'   => env('EMAIL_CHEF_PASSWORD'),
    'list_id'    => '97322',
    'contact_id' => '656023',
];
```

---

Usage
-----

[](#usage)

Every API class is instantiated directly — authentication is handled automatically via JWT.

### Account

[](#account)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\AccountApi;

$account = (new AccountApi())->getCollection();
// Returns AccountEntity with id, email, lang, status, subscribers, etc.
echo $account->email; // "admin@acme.com"
```

### Account Infos

[](#account-infos)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\AccountInfosApi;

$api    = new AccountInfosApi();
$info   = $api->getInstance('12345');
$result = $api->update([
    'company_name' => 'Acme Corp',
    'address'      => 'Via Roma 1, Milan',
]);
```

### Subscription

[](#subscription)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\SubscriptionApi;

$subscription = (new SubscriptionApi())->getCollection();
echo $subscription->type;            // "premium"
echo $subscription->plan_expiration; // "2027-01-15"
```

### Lists

[](#lists)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\ListsApi;

$lists = new ListsApi();

// Browse all lists
$all = $lists->getCollection(limit: 10, offset: 0, orderby: 'name', order_type: 'asc');

// Get details and stats
$list  = $lists->getInstance('97322');
$stats = $lists->getStats('97322', '2024-01-01', '2024-12-31');

// Create, update, delete
$created = $lists->create(['list_name' => 'Newsletter', 'list_description' => 'Main list']);
$lists->update('97322', ['list_name' => 'Updated Newsletter', 'list_description' => 'Updated']);
$lists->delete('97322');

// Subscribe / Unsubscribe
$lists->subscribe('97322', '656023');
$lists->unsubscribe('97322', '656023');
```

### Contacts

[](#contacts)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\ContactsApi;

$contacts = new ContactsApi();

$count   = $contacts->count('97322');
$all     = $contacts->getCollection('active', '97322', limit: 25, offset: 0, order_by: 'email', order_type: 'asc');
$contact = $contacts->getInstance('656023', '97322');

$created = $contacts->create([
    'list_id' => '97322',
    'email'   => 'john@example.com',
    'firstname' => 'John',
    'lastname'  => 'Doe',
]);

$contacts->update('656023', ['firstname' => 'Jane']);
$contacts->delete('97322', '656023');
```

### Predefined Fields

[](#predefined-fields)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\PredefinedFieldsApi;

$fields = (new PredefinedFieldsApi())->getCollection();
// Collection of PredefinedFieldsEntity with id, name, type_id, reference, etc.
```

### Custom Fields

[](#custom-fields)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\CustomFieldsApi;

$api = new CustomFieldsApi();

$fields = $api->getCollection('97322');
$field  = $api->getInstance('42');
$count  = $api->count('97322');

$api->create('97322', ['name' => 'Birthday', 'type_id' => '3']);
$api->update('42', ['name' => 'Birth Date']);
$api->delete('42');
```

### Blockings

[](#blockings)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\BlockingsApi;

$api = new BlockingsApi();

$blocked = $api->getCollection('spam', limit: 10, offset: 0);
$count   = $api->count('spam');

$api->create('block@example.com', 'email');
$api->delete('block@example.com');
```

### Import Tasks

[](#import-tasks)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\ImportTasksApi;

$api = new ImportTasksApi();

$tasks = $api->getCollection();
$task  = $api->getInstance('101');

$api->create('97322', [
    'contacts' => [
        ['email' => 'a@example.com', 'firstname' => 'Alice'],
        ['email' => 'b@example.com', 'firstname' => 'Bob'],
    ],
]);
```

### Segments

[](#segments)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\SegmentsApi;

$api = new SegmentsApi();

$segments      = $api->getCollection('97322', limit: 10, offset: 0);
$segment       = $api->getInstance('5');
$segmentCount  = $api->getCount('97322');
$contactsCount = $api->getContactsCount('5');

$api->createInstance(97322, [
    'name'  => 'VIP Customers',
    'logic' => 'and',
    'condition_groups' => [['field' => 'email', 'operator' => 'contains', 'value' => '@acme.com']],
]);
$api->updateInstance('97322', '5', ['name' => 'Premium VIPs']);
$api->deleteInstance('5');
```

### Campaigns

[](#campaigns)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\CampaignsApi;

$api = new CampaignsApi();

$count     = $api->getCount();
$campaigns = $api->getCollection('sent', limit: 10, offset: 0, orderby: 'name', ordertype: 'asc');
$campaign  = $api->getInstance('10');

$api->createInstance([
    'name'       => 'Summer Sale',
    'subject'    => 'Up to 50% off',
    'from_name'  => 'Acme Store',
    'from_email' => 'hello@acme.com',
    'html_body'  => 'Summer Sale!Shop now.',
]);
$api->updateInstance('10', ['subject' => 'Extended: Summer Sale']);
$api->deleteInstance('10');

$api->sendTestEmail('10', ['email' => 'test@acme.com']);
$api->sendCampaign('10', []);
$api->schedule('10', ['send_time' => '2026-07-01 09:00:00']);
$api->cancelScheduling('10');
$api->archive('10');
$api->unarchive('10');
$api->cloning(['id' => '10']);
$api->getLinkCollection('10');
```

### Autoresponders

[](#autoresponders)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\AutorespondersApi;

$api = new AutorespondersApi();

$count = $api->getCount();
$list  = $api->getCollection(limit: 10, offset: 0, orderby: 'name', ordertype: 'asc');
$ar    = $api->getInstance('20');

$api->createInstance([
    'name'      => 'Welcome Email',
    'subject'   => 'Welcome aboard!',
    'html_body' => 'Thanks for joining.',
]);
$api->updateInstance('20', ['subject' => 'Welcome to Acme!']);
$api->deleteInstance('20');

$api->sendTestEmail('20', ['email' => 'test@acme.com']);
$api->activate('20', []);
$api->deactivate('20', []);
$api->cloning(['id' => '20']);
$api->getLinksCollection('20');
```

### Send Mail (transactional)

[](#send-mail-transactional)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\SendEmailApi;

(new SendEmailApi())->sendMail([
    'to'      => 'customer@example.com',
    'subject' => 'Your order has shipped',
    'html'    => 'Track your order here.',
]);
```

### SMS

[](#sms)

```
use OfflineAgency\LaravelEmailChef\Api\Resources\SMSApi;

$sms = new SMSApi();

$sms->send(['to' => '+39 333 1234567', 'text' => 'Your verification code is 4821.']);
$sms->getBalance();                    // Balance entity with ->balance, ->currency
$sms->getStatusMessage('msg-abc123');  // StatusMessage entity
$sms->getBulkMessageStatus('bulk-1');  // BulkMessageStatus entity
```

---

API Coverage
------------

[](#api-coverage)

GroupStatusAccount✅Account Infos✅Subscription✅Lists✅Contacts✅Predefined Fields✅Custom Fields✅Blockings✅Import Tasks✅Segments✅Campaigns✅Autoresponders✅Send Mail✅SMS✅---

Testing
-------

[](#testing)

```
composer test                            # run all tests
./vendor/bin/pest --coverage             # with coverage report
./vendor/bin/pest --coverage --min=80    # enforce coverage gate
composer analyse                         # static analysis (PHPStan level 6)
composer lint                            # fix code style
composer lint:test                       # check code style (dry-run)
```

---

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

[](#contributing)

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

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

[](#security-vulnerabilities)

Please report security issues to .

Credits
-------

[](#credits)

- [Offline Agency](https://github.com/offline-agency)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

---

Proposed Improvements
---------------------

[](#proposed-improvements)

> **Note:** This section is a review aid for PR #11. It will be removed before merging.

### Proposal 1 — JWT token caching

[](#proposal-1--jwt-token-caching)

**Current:** A new JWT token is fetched via `POST /login` on every API class instantiation.

**Proposed:** Cache the token using Laravel's Cache facade with a TTL slightly shorter than server-side expiry (e.g. 55 minutes):

```
use Illuminate\Support\Facades\Cache;

private function getToken(): string
{
    return Cache::remember('emailchef_jwt', now()->addMinutes(55), function (): string {
        $response = Http::post(config('email-chef.login_url').'login', [
            'username' => config('email-chef.username'),
            'password' => config('email-chef.password'),
        ]);
        return $response->json('authkey');
    });
}
```

**Effort:** Low. **Impact:** Eliminates redundant auth round-trips.

---

### Proposal 2 — Exception hierarchy

[](#proposal-2--exception-hierarchy)

**Current:** API errors return an `Error` entity. Consumers cannot catch specific error types.

**Proposed:** Create `src/Exceptions/` hierarchy:

```
EmailChefException (base)
├── AuthenticationException   (401)
├── NotFoundException          (404)
├── ValidationException        (422 — carries field errors)
├── RateLimitException         (429 — includes Retry-After value)
└── ServerException            (5xx)

```

**Effort:** Medium. **Impact:** High — enables typed error handling.

---

### Proposal 3 — EmailChef Facade

[](#proposal-3--emailchef-facade)

**Current:** Users instantiate each API class manually (`new ListsApi()`).

**Proposed:** A single-entry-point facade:

```
use OfflineAgency\LaravelEmailChef\Facades\EmailChef;

EmailChef::lists()->getCollection(limit: 10, offset: 0, orderby: 'name', order_type: 'asc');
EmailChef::contacts()->count(listId: '97322');
EmailChef::campaigns()->sendCampaign('42', []);
```

**Effort:** Low-medium. **Impact:** High ergonomic value.

---

### Proposal 4 — Pagination abstraction

[](#proposal-4--pagination-abstraction)

**Current:** List endpoints return a single page. No standard way to iterate beyond page 1.

**Proposed:** A `PaginatedResponse` value object with `hasMorePages()` and an `->all()` convenience method that auto-fetches all pages.

**Effort:** Medium. **Impact:** Important for large contact lists.

---

### Proposal 5 — Config type-safety

[](#proposal-5--config-type-safety)

**Current:** Config keys like `'email-chef.baseUrl'` are raw strings. A typo silently returns `null`.

**Proposed:** A `src/EmailChefConfig.php` class with static accessors that throw on missing config:

```
final class EmailChefConfig
{
    public static function baseUrl(): string
    {
        return config('email-chef.baseUrl') ?? throw new \RuntimeException('EmailChef baseUrl not configured.');
    }
}
```

**Effort:** Low. **Impact:** IDE autocompletion + early failure on misconfiguration.

---

### Proposal 6 — Laravel 13 attribute adoption in examples

[](#proposal-6--laravel-13-attribute-adoption-in-examples)

Laravel 13 introduced first-party PHP Attribute support. The README examples could demonstrate modern L13 usage patterns:

```
use Illuminate\Routing\Attributes\Controllers\Middleware;

#[Middleware('auth')]
class NewsletterController
{
    public function subscribe(Request $request): JsonResponse
    {
        (new ListsApi())->subscribe(
            listId: config('email-chef.list_id'),
            data: $request->validated(),
        );
        return response()->json(['subscribed' => true]);
    }
}
```

**Effort:** Documentation only.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance83

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 53.4% 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 ~166 days

Recently: every ~250 days

Total

7

Last Release

87d ago

Major Versions

1.0.5 → 2.0.02026-04-07

PHP version history (2 changes)1.0.0PHP &gt;=7.4

2.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/33f8b76656d71bddf83e5924863f37dea04f3f89196e7fb9cf25e30c3ee27093?d=identicon)[offlineagency](/maintainers/offlineagency)

---

Top Contributors

[![Giacomo92](https://avatars.githubusercontent.com/u/11694429?v=4)](https://github.com/Giacomo92 "Giacomo92 (47 commits)")[![MarcoScapolo](https://avatars.githubusercontent.com/u/180169677?v=4)](https://github.com/MarcoScapolo "MarcoScapolo (17 commits)")[![petrealessio](https://avatars.githubusercontent.com/u/64196684?v=4)](https://github.com/petrealessio "petrealessio (13 commits)")[![ManuelRomanato](https://avatars.githubusercontent.com/u/85669332?v=4)](https://github.com/ManuelRomanato "ManuelRomanato (7 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (2 commits)")[![LucaMino](https://avatars.githubusercontent.com/u/110777562?v=4)](https://github.com/LucaMino "LucaMino (1 commits)")[![SanaviaNicolas](https://avatars.githubusercontent.com/u/56884198?v=4)](https://github.com/SanaviaNicolas "SanaviaNicolas (1 commits)")

---

Tags

laravelOfflineAgencylaravel-email-chef

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/offline-agency-laravel-email-chef/health.svg)

```
[![Health](https://phpackages.com/badges/offline-agency-laravel-email-chef/health.svg)](https://phpackages.com/packages/offline-agency-laravel-email-chef)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M885](/packages/laravel-socialite)[larastan/larastan

Larastan - Discover bugs in your code without running it. A phpstan/phpstan extension for Laravel

6.5k55.4M8.4k](/packages/larastan-larastan)

PHPackages © 2026

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