PHPackages                             erwane/cakephp-libs - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. erwane/cakephp-libs

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

erwane/cakephp-libs
===================

Erwane CakePHP Libs

3.0.0(1y ago)01.4kPHPPHP ^8.1

Since Apr 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Erwane/cakephp-libs)[ Packagist](https://packagist.org/packages/erwane/cakephp-libs)[ RSS](/packages/erwane-cakephp-libs/feed)WikiDiscussions 3.x Synced 2mo ago

READMEChangelogDependencies (5)Versions (17)Used By (0)

Some tools for CakePHP projects
===============================

[](#some-tools-for-cakephp-projects)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)[![codecov](https://camo.githubusercontent.com/2288e1b7015060153fc2f9c409c544acd8ff43b53b267b307839150ca8a8835c/68747470733a2f2f636f6465636f762e696f2f67682f457277616e652f63616b657068702d6c6962732f6272616e63682f332e782f67726170682f62616467652e7376673f746f6b656e3d766c4a4f61764877434f)](https://codecov.io/gh/Erwane/cakephp-libs)[![Build Status](https://github.com/Erwane/cakephp-libs/actions/workflows/ci.yml/badge.svg?branch=3.x)](https://github.com/Erwane/cakephp-libs/actions)[![Packagist Downloads](https://camo.githubusercontent.com/8d9ecac4e5fe86edc7faeb16e8fed2166184ae2da2130d453c9d118b67752660/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f457277616e652f63616b657068702d6c696273)](https://packagist.org/packages/Erwane/cakephp-libs)[![Packagist Version](https://camo.githubusercontent.com/e63c82f15c6da59de72b8a377320b2bc85f14cada16ad6fee4acdbae0c86d496/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f457277616e652f63616b657068702d6c696273)](https://packagist.org/packages/Erwane/cakephp-libs)

Version map
-----------

[](#version-map)

branchCakePHP corePHP min1.x^3.0PHP 7.22.x^4.0PHP 7.43.x^5.0PHP 8.1Mailer
------

[](#mailer)

Mailer class are mades to simplify the customization of e-mail templates.

Imagine you want to allow your App users or admins to customize theirs e-mails. With this classes, you can set some allowedVars in template and users can use it with `{{USER_NAME}}` syntax in email.

All vars need to be allowed with `setAllowedVars()` and are quoted. No injection risk.

### Mailer

[](#mailer-1)

```
use Ecl\Mailer\Mailer;
use Cake\ORM\Entity;

$mailer = new Mailer();
$mailer
    ->setAllowedVars(['USER_NAME'])
    ->setViewVars([
        'user' => new Entity(['name' => 'User Name']),
    ])
    ->setEmailFormat('text')
    ->deliver('Hello {{USER_NAME}}');
```

This will send a text e-mail with content below:

```
Hello User Name

```

This, work with reusable Mailer and templates too.

```
namespace App\Mailer;

use Ecl\Mailer\Mailer;

class UserMailer extends Mailer
{
    public function welcome($user)
    {
        $this
            ->setTo($user->email)
            ->setSubject(sprintf('Welcome %s', $user->name))
            ->setAllowedVars(['USER_NAME'])
            ->set(['user' => $user]);
    }
}

// templates/email/html/welcome.php
Hi {{USER_NAME}}
```

The Mailer add one new method `setAllowedVars(array): self`, required for template var replacement.

### Renderer

[](#renderer)

The rendered can be used without `Ecl\Mailer\Mailer` if you want to pre-fill a wysiwyg textarea.

```
use Ecl\Mailer\Renderer;

$invoice = $this->Invoices->get(1, ['contain' => ['Customers']]);

// Get template from DB (or templates dir)
/** @var \App\Model\Entity\EmailTemplate $emailTemplate */
$emailTemplate = $this->EmailTemplates
    ->find()
    ->where(['type' => 'invoice_send'])
    ->first();

$body = '';
if ($emailTemplate && $emailTemplate->body) {
    $renderer = new Renderer();
    $rendered = $renderer
        ->setAllowedVars([
            'INVOICE_NUM',
            'CUSTOMER_TITLE',
        ])
        ->set([
            'invoice' => $invoice,
            'customer' => $invoice->customer,
        ])
        ->render($emailTemplate->body, ['html']);

    $body = $rendered['html'];
}
```

`$body` now contain the formatted body e-mail with all allowed vars replaced by values in entities.

```

Hi {{CUSTOMER_TITLE}}.

    Please find your invoice {{INVOICE_NUM}} attached.

Hi Company name.

    Please find your invoice FC-202102-01234 attached.

```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance41

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 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.

###  Release Activity

Cadence

Every ~163 days

Recently: every ~235 days

Total

16

Last Release

495d ago

Major Versions

1.1.0 → 2.0.02021-01-19

2.0.6 → 3.0.02025-01-04

PHP version history (6 changes)1.0.0PHP &gt;=5.6

1.0.1PHP &gt;=7

v1.x-devPHP ^7.2

2.0.6PHP ^7.2 || ^8.0

3.0.0PHP ^8.1

2.0.7PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/91732d78336582954080932d4350d08420a053dbba6728f1727b5500ab931c65?d=identicon)[Erwane](/maintainers/Erwane)

---

Top Contributors

[![Erwane](https://avatars.githubusercontent.com/u/712604?v=4)](https://github.com/Erwane "Erwane (66 commits)")

---

Tags

cakephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/erwane-cakephp-libs/health.svg)

```
[![Health](https://phpackages.com/badges/erwane-cakephp-libs/health.svg)](https://phpackages.com/packages/erwane-cakephp-libs)
```

###  Alternatives

[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[markstory/asset_compress

An asset compression plugin for CakePHP. Provides file concatenation and a flexible filter system for preprocessing and minification.

3761.0M11](/packages/markstory-asset-compress)[dereuromark/cakephp-shim

A CakePHP plugin to shim applications between major framework versions.

401.0M11](/packages/dereuromark-cakephp-shim)[cakedc/cakephp-phpstan

CakePHP plugin extension for PHPStan.

40676.6k31](/packages/cakedc-cakephp-phpstan)[dereuromark/cakephp-dto

A CakePHP plugin for generating immutable Data Transfer Objects with full type safety

2988.9k3](/packages/dereuromark-cakephp-dto)[dereuromark/cakephp-geo

A CakePHP plugin around geocoding tools and helpers.

51174.9k4](/packages/dereuromark-cakephp-geo)

PHPackages © 2026

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