PHPackages                             cocojr/clean-architecture - 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. cocojr/clean-architecture

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

cocojr/clean-architecture
=========================

Clean architecture implementation

v1.2.3(5y ago)122PHPPHP &gt;=7.4

Since Oct 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/CocoJr/clean-architecture)[ Packagist](https://packagist.org/packages/cocojr/clean-architecture)[ RSS](/packages/cocojr-clean-architecture/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (15)Used By (0)

Clean Architecture and CQS Pattern Implementation in Symfony
============================================================

[](#clean-architecture-and-cqs-pattern-implementation-in-symfony)

Overview
--------

[](#overview)

This repository is an example implementation of the Clean Architecture and the Command Query Separation (CQS) pattern in a Symfony application. Clean Architecture is a software design philosophy that separates concerns and enforces a clear division between the application's core business logic, application-specific code, and external dependencies. The CQS pattern emphasizes the separation of commands (actions that change the application's state) and queries (actions that return data without affecting the state).

Getting Started
---------------

[](#getting-started)

To run this project locally, follow these steps:

1. Copy the `.env.dist` file to `.env` and update the values as needed.
2. Start the Docker containers:

```
docker-compose up --build -d
```

3. Install project dependencies:

```
docker-compose exec app make init
```

4. Access the Symfony application in your browser at:

```
http://localhost:
```

(Use the FRONT\_PORT value from your .env file.)

5. Access the RabbitMQ Management UI at:

```
http://localhost:
```

(Use the RABBITMQ\_PORT value from your .env file.)

6. To generate code coverage reports, run the following command:

```
docker-compose exec app make test-coverage
```

You can view the code coverage results at:

```
http://localhost:/coverage
```

Architecture Explanation
------------------------

[](#architecture-explanation)

- **src/Application**: This directory contains the application layer, which includes command and query implementations. It represents the use cases of the application.
- **src/Domain**: The domain layer holds the core business logic. It enforces the separation between business rules and application-specific code.
- **src/Infrastructure**: The infrastructure layer implements the interfaces defined in the application and domain layers. Here, you'll find the code that interacts with external systems and frameworks.
- **tests/Functionals**: These functional tests validate the end-to-end functionality, data integrity, user interactions, external integrations, error handling, and performance of the application.
- **tests/Integrations**: Integration tests focus on testing the use cases of the application and should also avoid mocking the infrastructure layer.
- **tests/Units**: The unit tests ensure the correctness of small, isolated units of code.

Remember, in the Domain layers, we use native PHP, in the Application layer we use the Domain layer as well, while the Infrastructure layer leverages frameworks and external libraries.

This architecture ensures a clean separation of concerns, maintainability, and testability in your application.

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

[](#contributing)

Feel free to contribute to this project by opening issues, submitting pull requests, or providing feedback. We welcome collaboration from the community to enhance this example of Clean Architecture and the CQS pattern in Symfony.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity61

Established project with proven stability

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 ~11 days

Recently: every ~37 days

Total

14

Last Release

1872d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2eda49ddd34950aca1c13df56a9591c6cf65d60c618f318e61d38b9a23206cd?d=identicon)[CocoJr](/maintainers/CocoJr)

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/cocojr-clean-architecture/health.svg)

```
[![Health](https://phpackages.com/badges/cocojr-clean-architecture/health.svg)](https://phpackages.com/packages/cocojr-clean-architecture)
```

###  Alternatives

[razonyang/yii2-rate-limiter

Yii2 Rate Limiter

1025.0k1](/packages/razonyang-yii2-rate-limiter)

PHPackages © 2026

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