UNDERSTAND SILLBEAM

What is Sillbeam?

As an application grows, relationships between domain areas become harder to follow. Which modules may use each other directly? Which boundaries are private? Sillbeam makes these rules explicit and checks them during the Symfony container build.

You choose the domain structure. Sillbeam connects it to automatic integration and enforced architecture rules.

THE PURPOSE

Think in business domains.
Organize your code accordingly.

Billing and Payment may already be organized separately through Composer namespaces and native Symfony configuration. That alone does not define which direct references between them are permitted. Sillbeam adds declared and checked module dependencies.

Use a #[SillbeamModule] descriptor to define such an area as a module. Its directory and subdirectories belong to that module. Declare direct dependencies using the target modules’ descriptor classes. Billing and Payment can, for example, live under the default directory src/Module/.

MORE THAN DIRECTORIES

Organize ownership.
Make dependencies explicit.

Architecture checks verify that all declared target modules are known, boundaries between shared and private modules are respected, and the dependency graph contains no cycles. They also compare supported direct class references from active modules with their declared direct dependencies.

Invalid architecture prevents container compilation. Core v0.2.0 collects independently detectable findings and distinguishes violations from fatal errors that block further analysis steps. With the optional Console adapter, sillbeam:architecture and sillbeam:report provide reports before the container boots. Dynamic references, PHPDoc and string service IDs remain outside static reference analysis.

Understand architecture and checks
TWO LEVELS OF ORGANIZATION

Modules organize business domains.
Projects organize interfaces.

For an application with a single interface, domain modules may already provide the right structure. When shop, administration and API come together, Projects help organize their code and module assignments within the same Symfony application.

Shared modules

User or Billing can be assigned to several Projects. Their domain logic stays in one shared place even when different interfaces access it.

Private modules of a Project

A dashboard used only by the administration can live there as a private module. Other Projects cannot access this private module.

Projects can have their own hosts and route prefixes. They still share the container, database and event system. They provide no process, tenant or security isolation and do not enable independent deployments. Global subscribers and handlers are not automatically restricted to one host. Shared modules cannot depend on a Project’s private modules.

Explore Projects and their boundaries
THE CONTEXT

Symfony remains the foundation.

Sillbeam imports active Modules and direct Project areas through Symfony’s native service loaders: autowiring, autoconfiguration and DI attributes remain available. The registered Sillbeam route import loads Symfony attribute routes from the permitted controller directories in these areas.

Symfony

Container compilation and runtime remain with Symfony; existing service configuration takes precedence. App service imports covering broad directory trees must exclude module and Project directories. Otherwise, they also register code outside Sillbeam’s active selection.

Sillbeam

When DoctrineBundle is registered, Sillbeam automatically adds attribute mappings for active Modules and direct Project entities. Without DoctrineBundle, Doctrine is not required. Tables, migrations and database access remain the responsibility of Doctrine and the application.

Module checks use the dependencies you declare and the supported references found in your code. Whether the chosen boundaries fit your domain remains your decision. Sillbeam complements Symfony within your application; it neither replaces Symfony nor acts as a platform for integrating external systems.

GETTING STARTED

Start with one business domain.

You can introduce Sillbeam gradually. Begin with a manageable area of your application and group its code into a module. Existing Symfony structures can continue alongside it.

For the first module, check its declared dependencies, active service and route imports, and relevant tests. This shows which configuration and existing code adoption affects. You can add further domain areas gradually. Projects are only needed when multiple interfaces require their own scope.

A CONCRETE EXAMPLE

Billing and Payment: historical v0.1.0 evidence.

Billing and Payment: runnable example

Historical evidence for v0.1.0: previous package name, previous PHP namespace and unchanged original outputs from that version. This is not evidence of v0.2.0 reporting.

This example was executed with the published v0.1.0 bundle in an isolated Symfony application. Billing uses a service from Payment. The classes demonstrate architecture validation only; they do not process a payment.

TEXT
src/Module/
├── Billing/
│   ├── BillingModule.php
│   └── Service/
│       └── InvoiceService.php
└── Payment/
    ├── PaymentModule.php
    └── Service/
        └── PaymentService.php

These are all module files in the test application under the default root src/Module/. Without Projects, both enabled shared modules are active. Controllers, entities and a database are not required for this validation.

BillingModule.php: the corrected descriptor

PHP
<?php

declare(strict_types=1);

namespace App\Module\Billing;

use App\Module\Payment\PaymentModule;
use Sillbeam\Module\Attribute\SillbeamModule;

#[SillbeamModule(
    id: 'billing',
    description: 'Invoices',
    dependencies: [PaymentModule::class],
)]
final class BillingModule
{
}

PaymentModule.php: the target module

PHP
<?php

declare(strict_types=1);

namespace App\Module\Payment;

use Sillbeam\Module\Attribute\SillbeamModule;

#[SillbeamModule(id: 'payment', description: 'Payments')]
final class PaymentModule
{
}

InvoiceService.php: the direct code reference

PHP
<?php

declare(strict_types=1);

namespace App\Module\Billing\Service;

use App\Module\Payment\Service\PaymentService;

final readonly class InvoiceService
{
    public function __construct(private PaymentService $payments)
    {
    }
}

PaymentService.php: the referenced service

PHP
<?php

declare(strict_types=1);

namespace App\Module\Payment\Service;

final class PaymentService
{
}

Editorial explanation: The constructor parameter on line 11 directly references PaymentService. Billing must therefore list the descriptor PaymentModule::class directly in dependencies. A use import alone would not count as a checked reference; a transitive dependency would not permit this direct access.

Missing declaration: the build fails

Historical evidence for v0.1.0: previous package name, previous PHP namespace and unchanged original outputs from that version. This is not evidence of v0.2.0 reporting.

Remove only the PaymentModule::class entry from the Billing descriptor. The code reference in the service remains. The complete invalid descriptor is:

PHP
<?php

declare(strict_types=1);

namespace App\Module\Billing;

use App\Module\Payment\PaymentModule;
use Sillbeam\Module\Attribute\SillbeamModule;

#[SillbeamModule(
    id: 'billing',
    description: 'Invoices',
    dependencies: [],
)]
final class BillingModule
{
}
BASH
php bin/console cache:clear --no-ansi
Original output · php bin/console cache:clear --no-ansi

In CodeDependencyAnalyzer.php line 65:
                                                                               
  /tmp/sillbeam-billing-payment/src/Module/Billing/Service/InvoiceService.php  
  :11: Module "billing" uses "App\Module\Payment\Service\PaymentService" from  
   module "payment": does not declare a direct dependency.                     
                                                                               

Editorial explanation: Exit code 1. The error occurs during the Symfony container build, rather than as the result of a successful architecture command. CodeDependencyAnalyzer reports the concrete reference with its file and line. The absolute path comes from this run and changes with the application directory.

The command php bin/console sillbeam:architecture --no-ansi was also run before the correction: exit code 1 with the same build error and no architecture table. Validation stops at the first error raised. Multiple violations are not automatically reported together.

After the correction: the actual architecture

Historical evidence for v0.1.0: previous package name, previous PHP namespace and unchanged original outputs from that version. This is not evidence of v0.2.0 reporting.

Restore dependencies: [PaymentModule::class] in the Billing descriptor. Rebuild the cache, then run the architecture command. Both commands returned exit code 0 in this run.

BASH
php bin/console cache:clear --no-ansi
php bin/console sillbeam:architecture --no-ansi
Original output · php bin/console cache:clear --no-ansi

 // Clearing the cache for the dev environment with debug true                  

 [OK] Cache for the "dev" environment (debug=true) was successfully cleared.    

Original output · php bin/console sillbeam:architecture --no-ansi
 --------- -------- -------- --------------------- -------------------------------------------------- 
  Module    Scope    State    Declared / observed   Directory                                         
 --------- -------- -------- --------------------- -------------------------------------------------- 
  billing   shared   active   1 / 1                 /tmp/sillbeam-billing-payment/src/Module/Billing  
  payment   shared   active   0 / 0                 /tmp/sillbeam-billing-payment/src/Module/Payment  
 --------- -------- -------- --------------------- -------------------------------------------------- 

Editorial explanation: Declared / observed counts direct module dependencies, rather than individual class references. Billing has one declared and one observed dependency; Payment has none. Both modules are shared and active.

Also executed: php bin/console sillbeam:architecture --format=json --no-ansi. For Billing, the JSON catalog contains App\Module\Payment\PaymentModule in both declared_dependencies and observed_dependencies, plus the service, file path and line 11 under references. The complete unchanged JSON output is included with the reproduction files.

Versions, commands and reproduction files