PHPackages                             bro-world/core-bundle - 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. bro-world/core-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

bro-world/core-bundle
=====================

Core utilities &amp; services for Bro World projects

v02.4(6mo ago)1191proprietaryPHPPHP &gt;=8.3CI failing

Since Nov 4Pushed 6mo agoCompare

[ Source](https://github.com/rami-aouinti/bro-world-core)[ Packagist](https://packagist.org/packages/bro-world/core-bundle)[ Docs](https://github.com/rami-aouinti/bro-world-core)[ RSS](/packages/bro-world-core-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (26)Used By (0)

Bro World Core Bundle
=====================

[](#bro-world-core-bundle)

Core utilities and cross‑cutting services for Bro World microservices, packaged as a reusable Symfony bundle.

> **Goals**
>
> - Centralize shared code (traits, helpers, subscribers, transport strategies, small infra services)
> - Keep domain‑specific logic inside each microservice
> - Provide clean, opt‑in configuration (no hard coupling)

---

Requirements
------------

[](#requirements)

- **PHP**: 8.3+
- **Symfony**: 7.2+
- **Optional**:
    - `ramsey/uuid` and `ramsey/uuid-doctrine` (if you use UUID value objects / DBAL types)
    - `symfony/messenger` (if you use the retry strategy included here)
    - `symfony/serializer`, `symfony/validator` (if you use provided helpers/subscribers relying on them)

> The bundle does **not** force `doctrine/orm` as a hard dependency. Install it in your apps as needed.

---

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

[](#installation)

### A) From Packagist (recommended)

[](#a-from-packagist-recommended)

```
composer require bro-world/core-bundle:^0.1
```

### B) From Git (VCS)

[](#b-from-git-vcs)

```
composer config repositories.bro-world-core vcs https://github.com/rami-aouinti/bro-world-core
composer require bro-world/core-bundle:^0.1
# Or, if you don’t have a tag yet:
composer require "bro-world/core-bundle:dev-master@dev"
```

### Enable the bundle

[](#enable-the-bundle)

```
// config/bundles.php
return [
    // ...
    Bro\WorldCoreBundle\BroWorldCoreBundle::class => ['all' => true],
];
```

---

Configuration
-------------

[](#configuration)

Create `config/packages/bro_world_core.yaml` in your app. All options are **optional** and have sensible defaults.

```
bro_world_core:
  default_locale: 'fr'             # default: 'fr'
  enable_feature_x: false          # default: false (example toggle)
  jwt_public_key: null             # e.g. '%env(resolve:JWT_PUBLIC_KEY_PATH)%'

  security:
    # Regex used by the LexikJwtAuthenticatorService to decide which paths are secured
    secured_path_regex: '^/api/(?!.*(security)|(test)|(doc)).*$' # default shown

  messenger:
    failed_retry:
      # Whether messages in the "failed" transport are retryable via messenger:failed:retry
      is_retryable: false
      # Waiting time (ms) between retries when using the custom RetryStrategy
      waiting_time: 0

  api_proxy:
    base_urls:
      media: '%env(resolve:MEDIA_API_BASE_URL)%'
    upload_defaults:
      # Form field that will receive the resolved context value when uploading files
      context_key_field: 'contextKey'
      # Default form values can be provided (each request may override them)
      workplace_id: '%env(default::WORKPLACE_ID)%'
      private: true
      extra_fields:
        locale: '%locale%'
```

> If you don’t need a given area (e.g. Messenger), you can omit it entirely.

---

What’s included
---------------

[](#whats-included)

Depending on what you use in your apps, this bundle typically provides:

- **Infrastructure / Services**

    - `LexikJwtAuthenticatorService` — small helper to decide if a request path is secured (uses `security.secured_path_regex`).
    - `Clock` — tiny time helper returning `DateTimeImmutable::now()`.
- **Event Subscribers**

    - `ExceptionSubscriber` — example subscriber that may need the current environment injected.
- **Messenger**

    - `Infrastructure\Messenger\Strategy\FailedRetry` — a configurable `RetryStrategyInterface` implementation.
- **Doctrine/Domain** (if you choose to use them)

    - Doctrine traits such as `Uuid`, `Timestampable`, `Blameable`.
    - Optional auto‑registration of Ramsey UUID types when `ramsey/uuid-doctrine` is installed.

> The exact set may evolve; keep an eye on the changelog.

---

Service Wiring (what the bundle wires for you)
----------------------------------------------

[](#service-wiring-what-the-bundle-wires-for-you)

The bundle uses PHP config to autowire/autoconfigure its own namespace and binds common scalars so you don’t have to override them in each app, e.g.:

- `LexikJwtAuthenticatorService::$path` ⟶ `%bro_world_core.security.secured_path_regex%`
- `ExceptionSubscriber::$environment` ⟶ `%kernel.environment%`
- `FailedRetry::$isRetryable` ⟶ `%bro_world_core.messenger.failed_retry.is_retryable%`
- `FailedRetry::$retryWaitingTime` ⟶ `%bro_world_core.messenger.failed_retry.waiting_time%`
- `ApiProxyService::$baseUrls` ⟶ `%bro_world_core.api_proxy.base_urls%`
- `ApiProxyService::$uploadDefaults` ⟶ `%bro_world_core.api_proxy.upload_defaults%`

If you need to override any of those in a particular app, you can redefine the service in that app’s `services.yaml`.

---

Messenger Integration (optional)
--------------------------------

[](#messenger-integration-optional)

If you want to use the provided retry strategy:

```
# config/packages/messenger.yaml
framework:
  messenger:
    default_bus: command.bus

    transports:
      async: '%env(MESSENGER_TRANSPORT_DSN)%'
      failed: '%env(MESSENGER_TRANSPORT_DSN_FAILED)%'

    routing:
      'Bro\\WorldCoreBundle\\Message\\': async

    # Attach custom retry strategy to a transport when desired
    transports_options:
      failed:
        retry_strategy:
          service: 'Bro\\WorldCoreBundle\\Infrastructure\\Messenger\\Strategy\\FailedRetry'
```

> Set `bro_world_core.messenger.failed_retry.*` options in `bro_world_core.yaml` to control behavior.

---

Doctrine / Ramsey UUID (optional)
---------------------------------

[](#doctrine--ramsey-uuid-optional)

If your app uses Ramsey UUID and the DBAL types, install:

```
composer require ramsey/uuid ramsey/uuid-doctrine
```

The bundle can **prepend** a DBAL type mapping when Doctrine is present:

```
// Pseudocode inside the bundle (guarded):
if ($builder->hasExtension('doctrine') && class_exists(\Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType::class)) {
    $container->extension('doctrine', [
        'dbal' => [
            'types' => [
                'uuid_binary_ordered_time' => \Ramsey\Uuid\Doctrine\UuidBinaryOrderedTimeType::class,
            ],
        ],
    ]);
}
```

If you prefer, you can configure DBAL types manually in your app instead.

---

Usage Examples
--------------

[](#usage-examples)

### Secured path regex

[](#secured-path-regex)

```
# config/packages/bro_world_core.yaml
bro_world_core:
  security:
    secured_path_regex: '^/api/(?!.*(security)|(test)|(doc)).*$'
```

### Custom retry strategy for failed messages

[](#custom-retry-strategy-for-failed-messages)

```
# config/packages/bro_world_core.yaml
bro_world_core:
  messenger:
    failed_retry:
      is_retryable: true
      waiting_time: 5000  # 5s
```

### Configuring the API proxy

[](#configuring-the-api-proxy)

```
# config/packages/bro_world_core.yaml
bro_world_core:
  api_proxy:
    base_urls:
      media: 'https://media.example.tld/api'
      catalog: 'https://catalog.example.tld'
    upload_defaults:
      context_key_field: 'contextKey'
      context_id: '%env(default::MEDIA_CONTEXT_ID)%'
      media_folder: 'default'
      private: false
      headers:
        X-Source: 'bro-world-core'
```

```
use Bro\WorldCoreBundle\Infrastructure\Service\ApiProxyService;
use Symfony\Component\HttpFoundation\Request;

final class ExampleUploader
{
    public function __construct(private ApiProxyService $proxy) {}

    public function __invoke(Request $request): array
    {
        return $this->proxy->requestFile('POST', 'media', $request, [
            'contextKey' => 'product-images',
            'mediaFolder' => 'product-images',
        ]);
    }
}
```

### Injecting the Clock service

[](#injecting-the-clock-service)

```
use Bro\WorldCoreBundle\Infrastructure\Service\Clock;

final class ExampleController
{
    public function __construct(private Clock $clock) {}

    public function __invoke(): string
    {
        return $this->clock->now()->format(DATE_ATOM);
    }
}
```

---

Versioning &amp; Releases
-------------------------

[](#versioning--releases)

- Tags follow **SemVer** (e.g. `v0.1.0`, `v0.2.0`).
- When using `dev-master`, consider setting Composer’s `minimum-stability` to `dev` with `prefer-stable: true`, or define a branch alias in the bundle.

---

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

[](#contributing)

Issues and PRs are welcome.

- Issues:
- Please keep additions **generic** and **microservice‑agnostic**.

---

Security
--------

[](#security)

If you discover a security vulnerability, please open a private issue or contact the maintainer directly.

---

License
-------

[](#license)

See the `LICENSE` file distributed with this repository. (Composer currently advertises `proprietary`.)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance69

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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

Every ~1 days

Total

16

Last Release

183d ago

Major Versions

v0.1.9 → v02.02025-11-15

v0.2.4 → v02.42025-11-15

PHP version history (2 changes)v0.1.1PHP &gt;=8.2

v0.1.4PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/73b928194c976067efe6d289c891cdc3010503ad955445d71c2695972065bdd8?d=identicon)[rami-aouinti](/maintainers/rami-aouinti)

---

Top Contributors

[![rami-aouinti](https://avatars.githubusercontent.com/u/2651635?v=4)](https://github.com/rami-aouinti "rami-aouinti (43 commits)")

### Embed Badge

![Health badge](/badges/bro-world-core-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/bro-world-core-bundle/health.svg)](https://phpackages.com/packages/bro-world-core-bundle)
```

###  Alternatives

[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)

PHPackages © 2026

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