KoalaFacade/ddd-console
61.3
Adequate · 21 September 2026
2k
lines of production code
PHP
primary language
4
measurements over time
What this system is
This system is a Laravel package that automates the creation of Domain-Driven Design (DDD) project structures and scaffolds. It provides a suite of Artisan commands to generate domain-specific classes like actions, models, and value objects, as well as infrastructure components such as events, listeners, and seeders. The tool manages file system operations, namespace resolution, and Composer autoloader updates to maintain a modular architecture.
How it got here
2022 — DDD code generation scaffolding
22 changes.
The project established its foundational architecture for generating Domain-Driven Design structures, introducing a comprehensive suite of console commands and stub templates. This period focused on building the core logic for file creation, autoloader management, and data transfer objects to support the Laravel package's primary functionality.
2023 — CLI command scaffolding and testing
6 changes.
This period focused on implementing and testing a comprehensive set of Artisan commands for generating domain, infrastructure, and application classes. The work included fixing namespace resolution issues and adding extensive feature and unit tests to ensure the new scaffolding tools function correctly.
Features
Add Composer autoloader resolution action
A new action, ResolveComposerAutoLoaderAction, has been introduced to automatically update the project's composer.json file. This component reads the configured base directory and a list of base structures, then iterates through them to ensure each is registered in the PSR-4 autoload section of composer.json. This automates the process of keeping the autoloader configuration in sync with the application's directory structure.
src/Actions/Composer · high confidence
Add FactoryContractMakeAction to generate factory interfaces
A new FactoryContractMakeAction class has been introduced to handle the creation of factory interfaces. This action resolves the namespace and stub path for generating factory contracts, utilizing the InteractsWithConsole trait and implementing the Console interface. It provides specific logic for resolving placeholders, handling the name argument by stripping 'Factory' suffixes, and managing file creation with appropriate success or error handling.
src/Actions/Factory · medium confidence
Add FilePresentAction for filesystem conflict resolution
Introduced a new FilePresentAction class that checks for file existence and handles conflicts by either deleting the file if forced or throwing a FileAlreadyExistException if the file is already present.
src/Actions/Filesystem · high confidence
Add infrastructure:make commands for event, factory, listener, mail, observer, provider, and seeder generation
The application now includes seven new Artisan commands under the \infrastructure:make\ namespace, each generating a specific type of class file into the project's infrastructure directory. Users can now generate events, model factories, event listeners, mailables, database observers, service providers, and database seeders via the CLI. Each command accepts a name and domain argument, resolves the appropriate namespace and stub path, and creates the corresponding file structure, with the factory command additionally generating a related contract interface.
src/Commands/Infrastructure · high confidence
Add stub copy and placeholder replacement actions
Introduced two new readonly action classes, CopyStubAction and ReplacePlaceholderAction, to handle file system operations. CopyStubAction copies a stub file to a target path and then delegates to ReplacePlaceholderAction, which reads the file, iterates over a collection of placeholder key-value pairs, and replaces each placeholder in the file content before writing it back.
src/Actions/Stub · high confidence
Added DDD configuration for directory structure
A new configuration file (config/diamond.php) has been introduced to define the base directory and Domain-Driven Design (DDD) folder structure. Users can now customize the base directory (defaulting to 'src/') and map DDD layers (Infrastructure, Domain, Application) to specific directory names, enabling the generation of a modular DDD project structure.
config · high confidence
Initial project structure and tooling setup
The repository was initialized with essential configuration files to support development and quality standards. A .gitignore file was added to exclude vendor directories, IDE settings, and build artifacts. A LICENSE.md file was added under the MIT license. Build and testing tooling was introduced: phpstan.neon for static analysis at level 9, phpunit.xml for the test suite, and pint.json for code style enforcement using the Laravel preset. The README.md was updated with badges and project description.
(repo-wide) · high confidence
Introduce DiamondConsoleServiceProvider for command registration and config publishing
A new service provider, DiamondConsoleServiceProvider, has been added to the src directory. It registers console commands located in the Commands directory (including Application, Domain, and Infrastructure subdirectories) and publishes the diamond.php configuration file. The provider also binds the DataMapper interface to the DataMapperAction implementation as a singleton.
src · high confidence
Introduce ResolveCommandAction for command resolution logic
A new ResolveCommandAction class has been added to handle the resolution of commands. This action coordinates file system checks and stub copying via FilePresentAction and CopyStubAction, utilizing the Console interface to gather necessary data such as file names, namespace paths, and placeholders.
src/Actions/Command · high confidence
Introduce Source helper class for path and namespace resolution
A new \Source\ class has been added to \src/Support/Source.php\ to centralize logic for resolving file paths and PHP namespaces. The class provides static methods to retrieve base, domain, infrastructure, and application paths from configuration, as well as utilities to transform namespaces to file system paths and resolve stub file locations. This change supports the broader refactoring of the console command system by providing a modular, single-responsibility component for path and namespace management.
src/Support · high confidence
Introduce new console commands for domain-driven structure installation and migration generation
Added InstallCommand to automate the creation of a domain-driven project structure, including directory generation, Composer autoloader resolution, and refactoring of existing providers into an infrastructure layer. Also added MigrationMakeCommand to generate new database migrations with support for create and table options, utilizing stub copying and placeholder data transfer objects.
src/Commands · high confidence
Introduces new contracts and interfaces for console, factory, and data mapping
Adds several new interfaces to the codebase: DataMapper, Factory, LifeCycle, Options, Arguments, Placeholders, Console, and a corresponding DataMapperAction class. These define the structure for mapping data, resolving factory instances, managing lifecycle hooks, and handling console options and placeholders, enabling a more modular and testable architecture for command and factory generation.
src/Contracts · high confidence
New Foundation classes for Actions, Factories, and Data Transfer Objects
The Foundation layer now includes new abstract classes: Action, CreateNewFactory, and DataTransferObject. The DataTransferObject provides a structured way to handle data with features like automatic snake\_case array conversion, cloning, conditionability, and a 'recycle' method for data transformation. The Action class offers a static resolve method for dependency injection, while CreateNewFactory extends Laravel's Eloquent Factory with a resolveFactory method. These additions provide a consistent base for building actions, database factories, and data transfer objects within the application.
src/Foundation · medium confidence
New HasResolvable trait for DataTransferObject hydration
A new \HasResolvable\ trait is introduced to the \DataTransferObject\ foundation, providing a \resolveFrom\ entry point that accepts \FormRequest\, Eloquent \Model\, or \array\ inputs. The trait also includes a \hydrate\ method that delegates to a \DataMapper\ for unstructured data resolution, alongside deprecated \resolve\ and \resolveFromArray\ methods for backward compatibility.
src/Foundation/DataTransferObject · high confidence
New console command concerns for argument and option resolution
Added three new traits to the \src/Commands/Concerns\ directory to standardize how console commands process inputs. The \HasArguments\ trait provides methods to resolve the 'domain' and 'name' arguments, while \HasOptions\ exposes the 'force', 'factory', 'event', 'model', and 'table' options. Additionally, \InteractsWithConsole\ introduces a \handle\ method that orchestrates the command lifecycle by calling \beforeCreate\, executing a \ResolveCommandAction\, and then calling \afterCreate\, along with helper methods for generating file paths and class names.
src/Commands/Concerns · high confidence
New domain scaffolding commands for Actions, Builders, Enums, Models, and Value Objects
The application now includes five new Artisan commands for generating domain-specific classes: \domain:make:action\, \domain:make:builder\, \domain:make:enum\, \domain:make:model\, and \domain:make:value-object\. These commands allow users to quickly scaffold corresponding files in their project, with the model command additionally supporting optional migration and factory generation.
src/Commands/Domain · high confidence
New stub templates for generating common application classes
The application now includes a comprehensive set of stub templates in the \stubs/\ directory, enabling the generation of various PHP classes directly from the command line. New templates have been added for Actions, Enums, Events, Listeners, Mails, Models (including Factories), Observers, Providers, Requests, Resources, Seeders, and Value Objects. Additionally, stubs for database migrations (both creating and altering tables) and Eloquent Builders are now available. These templates provide the structural foundation for these components, each pre-configured with the necessary namespaces, base classes, and method signatures to streamline development.
stubs · high confidence
Behavioural changes
Add FileAlreadyExistException for duplicate file handling
A new exception class, FileAlreadyExistException, has been introduced in the Exceptions directory. This change allows the application to explicitly handle scenarios where a file already exists, providing a structured way to manage this specific error condition with a 'forbidden' HTTP status code.
src/Exceptions · high confidence
Introduces Layer enum for namespace and path resolution
Adds a new Layer enum in src/Enums/Layer.php that defines application, domain, and infrastructure layers. This enum provides methods to resolve namespaces and file paths based on configuration, supporting the refactoring of namespace transformations to be modular.
src/Enums · high confidence
Introduces new Data Transfer Objects for console stub generation
The codebase adds four new readonly Data Transfer Objects—CopyStubData, FilePresentData, NamespaceData, and PlaceholderData—each extending the base DataTransferObject. These DTOs encapsulate specific configuration data required for generating console command stubs, including file paths, namespace structures, and placeholder values for template substitution.
src/DataTransferObjects · medium confidence
Fixes
Fix namespace resolution and missing abstract methods in application command generators
The application command generators (DataTransferObject, Request, Resource, and the shared InteractsWithConsoleInApplication trait) were failing due to incorrect namespace handling and missing abstract method implementations. Specifically, the DataTransferObjectMakeCommand now correctly resolves the namespace for DTOs in the app/ directory, and the InteractsWithConsoleInApplication trait properly implements the getNamespace() abstract method required by the Console contract. These fixes ensure that running commands like 'application:make:data-transfer-object' or 'application:make:request' correctly generates files in the appropriate application subdirectories without namespace errors.
src/Commands/Application · medium confidence
Test coverage
Added feature tests for domain command generators; Added feature tests for infrastructure make commands; Added tests for Diamond console commands; Added unit tests for Composer autoloader resolution; Added unit tests for DataTransferObject functionality; Initializes Pest testing framework and base test case.
Dependencies
Initial package configuration for Laravel DDD generator
The project now includes a composer.json file that defines the package 'koalafacade/diamond-console' as a Laravel package for generating DDD structures. It requires PHP 8.2 and specific versions of Laravel components (illuminate/support, console, filesystem, container) supporting versions 9.41, 10.0.0, and 11.0. Development dependencies include Pest for testing, Laravel Pint for code style, and PHPStan for static analysis.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 60 → 61 (+0.8)
- Rubric changed (rubric-2026.08.19 → rubric-2026.09.15) — scores are not directly comparable.
Lenses
- Code Health 100 → 99 (-0.6)
- Architecture 100 → 91 (-9.2)
- Maturity 43 → 43 (+0.0)
- Readiness 68 → 60 (-7.3)
- Security 71 → 98 (+27.3)
Resolved (11)
- Coverage not included — suite not readable by the collector
- Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
- Duplicated block (11 lines × 2) (src/Commands/Application/ResourceMakeCommand.php)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- No exposed public API
- Test reliability not included
- dormant codebase — no living knowledge left to concentrate
New (22)
- Dependency hygiene PARTLY measured — Composer dependencies read, no committed lock to grade for currency
- Documentation: no installation or build instructions (README.md)
- Duplicate getNamespace() method across InteractsWithConsole, InteractsWithConsoleInApplication, and Console contract. Similar to getNamespacePath(), this creates ambiguity about which source of truth to use and suggests poor abstraction design where the same logic is repeated across different layers of the API.
- Duplicate intent across multiple traits/interfaces with unclear hierarchy. InteractsWithConsole and InteractsWithConsoleInApplication both expose getNamespacePath(). Additionally, the Console contract also exposes getNamespacePath(). It is unclear if these are distinct implementations or if one should extend the other. The naming InteractsWithConsoleInApplication suggests a specific context, but the method signature is identical to the base concern, leading to potential confusion about which trait to use or if they are mutually exclusive.
- Duplicated block (12 lines × 2) (src/Commands/Application/ResourceMakeCommand.php)
- Duplicated block (31 lines × 2) (src/Commands/Domain/ActionMakeCommand.php)
- Duplicated block (31 lines × 3) (src/Commands/Infrastructure/EventMakeCommand.php)
- Duplicated block (7 lines × 2) (src/Commands/Application/RequestMakeCommand.php)
- Duplicated block (8 lines × 2) (src/Commands/Domain/BuilderMakeCommand.php)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- High: security finding (details withheld)
- Inconsistent naming for resolving the 'name' argument. HasArguments and Arguments contract use resolveNameArgument(), but FactoryContractMakeAction also has resolveNameArgument(). While the name is consistent, the placement is inconsistent: it is in a trait (HasArguments) for general commands, but duplicated in a specific action class (FactoryContractMakeAction) that likely also uses the trait or similar logic. This suggests code duplication or a failure to leverage the existing concern.
- Medium: security finding (details withheld)
- No dependency advisory monitoring
- Potential redundancy between CreateNewFactory and Factory contract. CreateNewFactory is in the Foundation namespace and implements resolveFactory(), which is also defined in the Factory contract. It is unclear if CreateNewFactory is an implementation of Factory or a separate utility. If it is an implementation, it should explicitly implement the contract. If it is a separate utility, the naming is confusingly similar.
- …and 2 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
KoalaFacade/ddd-console was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 21 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 437b74afed5ccfc4fd5bc93d2f26d33eeef299d6 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-fa71c66cabd8.