PHPackages                             bloise/flunt-php - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. bloise/flunt-php

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

bloise/flunt-php
================

Library for notifications and validations

1.0.0(3y ago)96MITPHPPHP &gt;=8.1

Since May 28Pushed 3y ago1 watchersCompare

[ Source](https://github.com/matheusbloise/flunt-php)[ Packagist](https://packagist.org/packages/bloise/flunt-php)[ RSS](/packages/bloise-flunt-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Flunt PHP implementation of Domain Notification Pattern
=======================================================

[](#flunt-php-implementation-of-domain-notification-pattern)

PHP implementation of Domain Notification Pattern based in [Flunt](https://github.com/andrebaltieri/flunt) (.NET) developed by @andrebaltieri

### Flunt

[](#flunt)

Flunt is a fluent way to use Notification Pattern with your entities, concentrating every change you made and easy accessing it when you need.

check our [Wiki](https://github.com/andrebaltieri/Flunt/wiki) for more details and samples of how to use Flunt in your applications.

### Dependencies

[](#dependencies)

PackageVersion`PHP``>=8.1`### Instalation

[](#instalation)

This package is available through Packagist

**Composer**

```
composer require bloise/flunt

```

How to use
----------

[](#how-to-use)

```
final class CPF extends Notifiable
{
  ...
}

$cpf = new CPF('012.345.678-90');
$cpf->addNotification("CPF", "Invalid document");

if($cpf->isValid())
  ...
```

Specified contract
------------------

[](#specified-contract)

```
final class CPF extends Notifiable
{
    private readonly string $document;

    public function __construct(string $document)
    {
        $this->setDocument($document);
        $this->addNotifications(
            (new CPFContract)
                ->hasMinLen($this->document, 'CPF', 'Invalid length')
                ->validFormat($this->document, 'CPF', 'Invalid format')
                ->validDocument($this->document, 'CPF', 'Invalid document')
        );
    }
}

final class CPFContract extends Contract
{
    public function hasMinLen(string $cpf, string $property, string $message): self {
        if (strlen($cpf) != 11) {
            $this->notifications[$property][] = $message;
        }
    }

    public function validFormat(string $cpf, string $property, string $message): self {...}

    public function validDocument(string $cpf, string $property, string $message): self {...}
}
```

Fluent Methods
--------------

[](#fluent-methods)

```
$cpf->isValid();
$cpf->getMessages();
$cpf->filterByMessage('Invalid length');
```

### Designed for modern architectures approaches

[](#designed-for-modern-architectures-approaches)

If you are building an application with clean architecture approaches you can consider use this project, cause it's totally free of external dependencies, feel free to implement a Port/Adapter linking the dependencie with your code base, this one is for those who are more conceptual =)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1451d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9eb7691d26297f96838704ab9841ba9adea0425db73fc381c1f83521c950fdfc?d=identicon)[Matheus Bloise](/maintainers/Matheus%20Bloise)

---

Top Contributors

[![matheusbloise](https://avatars.githubusercontent.com/u/46876171?v=4)](https://github.com/matheusbloise "matheusbloise (6 commits)")

---

Tags

ddddomainphp

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bloise-flunt-php/health.svg)

```
[![Health](https://phpackages.com/badges/bloise-flunt-php/health.svg)](https://phpackages.com/packages/bloise-flunt-php)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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