PHPackages                             anis-saied/user-core-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. anis-saied/user-core-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

anis-saied/user-core-php
========================

Core user domain logic (framework agnostic)

v1.0.0(3mo ago)00MITPHPPHP &gt;=8.2

Since Jan 27Pushed 3mo agoCompare

[ Source](https://github.com/anis-saied/user-core-php)[ Packagist](https://packagist.org/packages/anis-saied/user-core-php)[ RSS](/packages/anis-saied-user-core-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

User-Core-PHP
=============

[](#user-core-php)

[![Version](https://camo.githubusercontent.com/34e695c6016bc2a934a96bed696e29b2f2ab562a7134d65a55d00653cd506bea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e737667)](https://github.com/anis-saied/user-core-php)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/d91d3d1139cf0d8faaa80eeeeac7d3c59c9319e56960ef81c948e4160be4c4c1/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3737376262342e737667)](https://www.php.net/)

Core domain User en PHP, framework-agnostic, basé sur DDD et SOLID.

- Core user domain logic, framework agnostic.
- package core agnostique

Principles
----------

[](#principles)

- Clean Architecture
- DDD (light)
- PSR standards
- No framework dependency

📦 Installation
--------------

[](#-installation)

```
composer require anis-saied/user-core-php
```

Architecture
------------

[](#architecture)

[![User Domain](./diagrams/user-domain.svg)](./diagrams/user-domain.svg)

- Domain : logique métier pure
- Application : cas d’usage
- Infrastructure : implémentations techniques
- tests : unitaires et intégration
- docs : diagrammes UML (PlantUML)

User
----

[](#user)

- le role de user dans ce package (user-core) est métier et non pas technique
- donc il ne doit pas mentionner des détails technique comme
    - les timestamps (created\_at, updated\_at)
- le domaine doit etre pure business logic, pas persistence
- dans laravel/Symphony, on pourra ajouter timestamps coté model/ORM
    - le core doit rester agnostique

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

[](#installation)

```
composer require anis-saied/user-core-php
```

Usage
-----

[](#usage)

```
use AnisSaied\UserCore\Domain\ValueObject\UserId;
use AnisSaied\UserCore\Domain\ValueObject\Email;
use AnisSaied\UserCore\Domain\User;
use AnisSaied\UserCore\Application\Service\UserService;
use AnisSaied\UserCore\Infrastructure\Persistence\InMemoryUserRepository;

/**
 * Repository
 */
$repository = new InMemoryUserRepository();

/**
 * Service
 * En test → InMemoryUserRepository
 * En Laravel → EloquentUserRepository
 * En Symfony → DoctrineUserRepository
 * Sans changer une seule ligne dans UserService.
 */
$service = new UserService($repository);

// Create a user
$user = new User(new UserId('1'), 'Anis', new Email('anis@example.com'));
$service->create($user);
```

Tests
-----

[](#tests)

- Tes tests sont déjà présents pour **Unit** et **Integration**
- Vérifie que :
    - Chaque méthode publique est couverte
    - Les **criteria**, `listByCriteria` et `matching` sont testés
    - Les tests peuvent tourner sur CI/CD (GitHub Actions par ex.)
- apply the tests by

```
vendor/bin/phpunit
```

Analyse statique
----------------

[](#analyse-statique)

PHPStan sert à détecter les erreurs dans ton code PHP sans l’exécuter. C’est ce qu’on appelle de l’analyse statique.

```
vendor/bin/phpstan analyse
```

---

Documentation / PHPDoc / UML
----------------------------

[](#documentation--phpdoc--uml)

- Les diagrammes PlantUML sont là (`user-domain.puml` + `.png`)
- Assure-toi que toutes les **classes et méthodes ont un docblock PHPDoc**
- Tu peux générer la doc HTML avec **phpDocumentor** ou **Sami** pour fournir un site de documentation complet

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance79

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

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

111d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/29a7881d2ab98f0e6fb369df1d10fe1d8f67a96a50c99e17a4b51f529cd3eccf?d=identicon)[asaied](/maintainers/asaied)

---

Top Contributors

[![anis-saied](https://avatars.githubusercontent.com/u/69865343?v=4)](https://github.com/anis-saied "anis-saied (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/anis-saied-user-core-php/health.svg)

```
[![Health](https://phpackages.com/badges/anis-saied-user-core-php/health.svg)](https://phpackages.com/packages/anis-saied-user-core-php)
```

PHPackages © 2026

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