gacela-project/gacela 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gacela-project/gacela

最新稳定版本:1.12.0

Composer 安装命令:

composer require gacela-project/gacela

包简介

Gacela helps you separate your project into modules

README 文档

README

Gacela logo

GitHub Build Status Scrutinizer Code Quality Scrutinizer Code Coverage Psalm Type-coverage Status Mutation testing badge MIT Software License

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 via ServiceResolverAwareTrait
  • Config methods on AbstractConfig that 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

统计信息

  • 总下载量: 110.87k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 134
  • 点击次数: 1
  • 依赖项目数: 12
  • 推荐数: 2

GitHub 信息

  • Stars: 134
  • Watchers: 7
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-04-01