gacela-project / gacela
Gacela helps you separate your project into modules
Fund package maintenance!
chemaclass.com/sponsor
Installs: 103 153
Dependents: 12
Suggesters: 2
Security: 0
Stars: 133
Watchers: 7
Forks: 8
Open Issues: 2
pkg:composer/gacela-project/gacela
Requires
- php: >=8.1
- gacela-project/container: ^0.8
Requires (Dev)
- ergebnis/composer-normalize: ^2.48
- friendsofphp/php-cs-fixer: ^3.89
- infection/infection: ^0.29
- phpbench/phpbench: ^1.4
- phpmetrics/phpmetrics: ^2.9
- phpstan/phpstan: ^1.12
- phpstan/phpstan-strict-rules: ^1.6
- phpunit/phpunit: ^10.5
- psalm/plugin-phpunit: ^0.19.5
- rector/rector: ^1.2
- symfony/console: ^6.4
- symfony/var-dumper: ^6.4
- vimeo/psalm: ^6.13
Suggests
- gacela-project/gacela-env-config-reader: Allows to read .env config files
- gacela-project/gacela-yaml-config-reader: Allows to read yml/yaml config files
- gacela-project/phpstan-extension: A set of phpstan rules for Gacela
- symfony/console: Allows to use vendor/bin/gacela script
- dev-main
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.1
- 1.9.0
- 1.8.1
- 1.8.0
- 1.7.1
- 1.7.0
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.1
- 1.0.0
- 0.32.0
- 0.31.0
- 0.30.1
- 0.30.0
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.1
- 0.23.0
- 0.22.0
- 0.21.0
- 0.20.0
- 0.19.0
- 0.18.1
- 0.18.0
- 0.17.2
- 0.17.1
- 0.17.0
- 0.16.0
- 0.15.0
- 0.14.0
- 0.13.0
- 0.12.0
- 0.11.0
- 0.10.0
- 0.9.0
- 0.8.0
- 0.7.0
- 0.6.0
- 0.5.0
- 0.4.0
- 0.3.0
- 0.2.0
- 0.1.0
- dev-ref/gacela-config
- dev-feat/contextual-bindings
- dev-feat/gacela-config-improvemets-2
- dev-feat/gacela-config-factory
- dev-feat/static-analysis-configs
- dev-ref/rename-DocBlockResolver
- dev-feat/cache-warming
- dev-feat/debug-container-command
- dev-codex/find-and-fix-vulnerabilities
- dev-add-with-all-to-modules-list
This package is auto-updated.
Last update: 2025-11-11 08:19:40 UTC
README
Gacela helps you build modular applications
VISION: Simplify the communication of your different modules in your web application.
MISSION: Normalize the entry point of a module, without interfering with your domain-business logic.
Splitting your project into different modules help in terms of maintainability and scalability. It encourages your modules to interact with each other in a unified way by following these rules:
- Modules interact with each other only via their Facade
- The Facade is the entry point of a module
- The Factory manage the intra-dependencies the module
- The Provider resolves the extra-dependencies of the module
- The Config access the project's config files
Installation
composer require gacela-project/gacela
Getting started
See the getting started guide for a step-by-step example of creating your first module.
Module structure
You can prefix gacela classes with the module name to improve readability. See more about gacela.
An example of an application structure using gacela modules:
application-name
├── gacela.php
├── config
│ └── ...
│
├── src
│ ├── ModuleA
│ │ ├── Domain
│ │ │ └── ...
│ │ ├── Application
│ │ │ └── ...
│ │ ├── Infrastructure
│ │ │ └── ...
│ │ │ # These are the 4 "gacela classes":
│ │ ├── Facade.php
│ │ ├── Factory.php
│ │ ├── Provider.php
│ │ └── Config.php
│ │
│ └── ModuleB
│ └── ...
│
├── tests
│ └── ...
└── vendor
└── ...
Static Analysis
Gacela provides configuration files for PHPStan and Psalm that suppress false positives related to dynamic resolution via #[ServiceMap] attributes.
PHPStan: Include phpstan-gacela.neon in your phpstan.neon:
includes: - vendor/gacela-project/gacela/phpstan-gacela.neon
Psalm: Include psalm-gacela.xml using XInclude:
<psalm xmlns:xi="http://www.w3.org/2001/XInclude" xmlns="https://getpsalm.org/schema/config" > <projectFiles> <directory name="src"/> </projectFiles> <!-- Include Gacela suppressions --> <xi:include href="vendor/gacela-project/gacela/psalm-gacela.xml"/> <issueHandlers> <!-- Your other issue handlers --> </issueHandlers> </psalm>
This suppresses warnings about:
- Magic methods
getFacade(),getFactory(),getConfig()resolved viaServiceResolverAwareTrait - Config methods on
AbstractConfigthat are resolved at runtime - Type mismatches where Gacela resolves the correct concrete type
Documentation
You can check the full documentation in the official website.
Examples
You can see examples using gacela in this repository.
Contribute
You are more than welcome to contribute reporting issues, sharing ideas, or contributing with your Pull Requests.
Inspired by Spryker Framework: https://github.com/spryker