4 min readCalm pace · scan the outline anytime

Laravel tooling

Pint, Pest architecture boundary tests, PHPStan/Larastan, and module scaffolds for the Laravel host.

Tooling

Tooling enforces and accelerates the Laravel adapter. It does not redefine Core.

Module scaffolds

php artisan make:module {ModuleName}
php artisan make:module-model {ModuleName} {ModelName}

Scaffolds should generate Application / Domain / Infrastructure / UI, plus Ports/Acl and Ports/Module. They must not create a literal Feature/ directory — {Capability} folders use real names (Order/, Fulfillment/).

Architecture boundary tests (Pest)

Enforce Core cross-module isolation so Application/Domain of module A cannot import Application/Domain of module B.

php artisan test --compact tests/Unit/ModuleBoundaryArchTest.php

Typical guards:

  • No foreign module namespaces inside Application/Domain
  • No Eloquent models inside Application/Domain
  • No PHP under a literal */Feature/ path
  • When adding a module, append its name to the $modules list in the arch test

Laravel Pint

Every PHP change should follow a shared pint.json (Laravel preset + project rules). Prefer Composer scripts:

composer lint                 # ./vendor/bin/pint
./vendor/bin/pint --dirty     # while coding
./vendor/bin/pint --test      # CI check-only

Useful alignments with Core naming:

AreaTypical Pint focus
Class layouttraits → constants → properties → __construct → methods
Typesdeclare_strict_types, return types
Importsordered, unused removed

Pint does not replace boundary tests.

PHPStan / Larastan

composer require --dev phpstan/phpstan larastan/larastan

Example phpstan.neon sketch:

includes:
    - ./vendor/larastan/larastan/extension.neon

parameters:
    phpVersion: 80400
    level: 5
    paths:
        - app

Raise levels gradually. Static analysis catches illegal types that style tools miss.

Suggested local loop

  1. Implement behind ports (fake/in-memory in tests).
  2. ./vendor/bin/pint --dirty
  3. Feature + unit tests for the Use Case.
  4. ModuleBoundaryArchTest green.
  5. PHPStan on touched paths.

Core reference: Anti-patterns · Decision tree.

Modular Hexagonal Domain-Driven Design
Core 1.0.0-draft