KoalaFacade/diamond-console
61.3
Adequate · 22 September 2026
2k
lines of production code
PHP
primary language
6
measurements over time
What this system is
This system is a Laravel package that provides a Domain-Driven Design (DDD) scaffolding tool for PHP applications. It automates the creation of directory structures and generates boilerplate code for various architectural layers, including domain entities, application services, and infrastructure components. The tool supports customizing the project's base paths and automatically updates the autoloader, streamlining the initial setup and ongoing development of DDD-based Laravel projects.
How it got here
2022 — DDD scaffolding and code generation
22 changes.
The project established its foundational architecture by implementing a Domain-Driven Design (DDD) scaffolding system. This involved creating a suite of Artisan commands and stub templates to automatically generate directory structures, classes, and configuration files. The period focused on building the core logic for file system operations, autoloader management, and data transfer objects to support this code generation workflow.
2023 — CLI scaffolding commands
6 changes.
This period focused on implementing a comprehensive set of Artisan commands to scaffold domain, infrastructure, and application layer artifacts. The work included generating classes for actions, builders, models, events, and DTOs, accompanied by extensive feature and unit tests to ensure correct file creation and error handling.
Features
Add DDD configuration for code generation
A new configuration file (config/diamond.php) has been added to define the base directory and Domain-Driven Design structure mappings. This allows users to customize the directory names for Infrastructure, Domain, and Application layers, which are used by the command-line tool to generate the initial project structure.
config · high confidence
Add FilePresentAction for file existence checks
A new FilePresentAction class has been introduced in the Filesystem namespace. This action checks if a file exists and optionally deletes it if the force flag is set, or throws a FileAlreadyExistException if the file is present and force is not enabled.
src/Actions/Filesystem · medium confidence
Add domain scaffolding commands for actions, builders, enums, models, and value objects
Users can now generate domain-specific artifacts via new Artisan commands: \domain:make:action\, \domain:make:builder\, \domain:make:enum\, \domain:make:model\, and \domain:make:value-object\. These commands create corresponding files in the project's domain structure, with the model command optionally triggering migration and factory generation.
src/Commands/Domain · high confidence
Add infrastructure make commands for event, factory, listener, mail, observer, provider, and seeder
New console commands have been added to the \infrastructure:make\ namespace, allowing users to generate specific infrastructure components directly from the CLI. These include \EventMakeCommand\ for creating events, \FactoryMakeCommand\ for model factories, \ListenerMakeCommand\ for event listeners, \MailMakeCommand\ for mail classes, \ObserverMakeCommand\ for database observers, \ProviderMakeCommand\ for service providers, and \SeederMakeCommand\ for database seeders. Each command follows a consistent pattern of resolving namespaces and placeholders to scaffold the respective files into the project.
src/Commands/Infrastructure · high confidence
Add stub file copying and placeholder replacement actions
Introduced two new action classes, CopyStubAction and ReplacePlaceholderAction, to handle the process of copying stub files and replacing placeholders within them. CopyStubAction manages the file system operations to copy a stub to a target path, while ReplacePlaceholderAction processes the copied file to substitute specific placeholders with provided data. This adds a new capability for generating or templating files based on stubs.
src/Actions/Stub · high confidence
Add stub templates for new code generation commands
The \stubs/\ directory now includes template files for a wide range of Laravel and framework components, enabling new code generation commands. Added stubs include: \action\, \builder\ and \builder-model\, \data-transfer-object\, \enum\, \event\, \factory\ and \factory-contract\, \listener\ and \listener-event\, \mail\, \migration\ (create, table, and base), \model\ and \model-factory\, \observer\, \provider\, \request\, \resource\ and \resource-model\, \seeder\, and \value-object\. These templates provide the structural foundation for generating these specific types of classes and files within the application.
stubs · high confidence
Added FactoryContractMakeAction to generate factory contracts
A new FactoryContractMakeAction class has been introduced in the Factory namespace. This action is responsible for generating factory contracts, utilizing the InteractsWithConsole trait and implementing the Console interface. It handles namespace resolution, placeholder resolution, and file creation for factory contracts, marking a shift towards a more structured approach to generating these specific types of files.
src/Actions/Factory · medium confidence
Added console commands for generating application layer artifacts
Introduced new Artisan commands to scaffold application-specific components, including Data Transfer Objects, HTTP Requests, and API Resources. These commands, located in the src/Commands/Application directory, utilize a shared concern trait to resolve namespaces and file paths, streamlining the creation of these files within the project structure.
src/Commands/Application · high confidence
Initial project structure and tooling configuration
The repository was initialized with essential configuration files to support development and quality assurance. A .gitignore file was added to exclude vendor directories, IDE settings, and lock files. A LICENSE.md file was added to define the MIT license. A phpstan.neon file was introduced to configure PHPStan at level 9 for static analysis. A phpunit.xml file was added to configure the PHPUnit test suite and code coverage for the src and tests directories. A pint.json file was added to configure Laravel Pint for code style enforcement. Finally, the README.md was updated to include project badges and documentation links.
(repo-wide) · high confidence
Introduce DiamondConsoleServiceProvider for DDD command generation
Added a new service provider, DiamondConsoleServiceProvider, which registers console commands for generating the base structure of a Domain-Driven Design (DDD) application. The provider registers a singleton binding for the DataMapper interface, publishes the diamond configuration file, and dynamically resolves command classes from the Commands directory and its subdirectories (Application, Domain, Infrastructure) to support the new DDD scaffolding capabilities.
src · high confidence
Introduce HasResolvable trait for Data Transfer Objects
A new \HasResolvable\ trait has been added to the \DataTransferObject\ foundation, providing a unified entry point for resolving unstructured data into DTOs. The trait introduces a \resolveFrom\ method that automatically dispatches to specific resolvers for \FormRequest\, Eloquent \Model\, or raw \array\ inputs. It also includes a \hydrate\ method that delegates to a \DataMapper\ service, alongside deprecated aliases (\resolve\, \resolveFromArray\) to maintain backward compatibility.
src/Foundation/DataTransferObject · high confidence
Introduce Layer enum for namespace and path resolution
A new Layer enum has been added to define application, domain, and infrastructure layers. This enum provides methods to resolve namespaces and file paths based on configuration, enabling modular and consistent directory structure generation for different architectural layers.
src/Enums · high confidence
Introduce Source helper class for path and namespace resolution
Added a new Source class in the Support directory that centralizes logic for resolving file paths and generating PHP namespaces. The class provides static methods to map configuration keys to directory paths, convert namespaces to file-system paths, and resolve stub file locations, supporting the framework's code generation and structure management.
src/Support · medium confidence
Introduce new Artisan commands for domain-driven project scaffolding
Added \InstallCommand\ and \MigrationMakeCommand\ to support a domain-driven structure. The \InstallCommand\ generates base directories and refactors the application's provider paths to align with the new structure, while \MigrationMakeCommand\ creates migration files using specific stubs and placeholders.
src/Commands · high confidence
Introduce new data transfer objects for console command scaffolding
Added four new readonly data transfer objects to the application's core: CopyStubData, FilePresentData, NamespaceData, and PlaceholderData. These classes encapsulate the specific configuration and state required for generating and managing code stubs and file system operations within the console commands, replacing previous ad-hoc parameter passing with structured data contracts.
src/DataTransferObjects · high confidence
Introduces new command helper traits for argument, option, and console interaction
Three new traits have been added to the codebase to standardize how commands handle inputs and file generation. The \HasArguments\ trait provides methods to resolve and format the 'domain' and 'name' arguments. The \HasOptions\ trait offers helpers to resolve boolean flags like 'force' and 'factory', as well as string options for 'event' and 'model'. Additionally, the \InteractsWithConsole\ trait centralizes the command execution flow, managing the generation of file paths, class names, and full file paths, while providing hooks for pre- and post-creation logic.
src/Commands/Concerns · high confidence
Introduces new contract interfaces for console and data mapping
The codebase now includes a set of new interfaces in the Contracts directory to define the structure for console commands and data mapping. Specifically, the \Console\ interface aggregates several smaller interfaces (\Options\, \Placeholders\, \Arguments\, and \LifeCycle\) to standardize command behavior, while \DataMapper\ and \Factory\ interfaces provide contracts for data transformation and factory resolution. These additions establish the foundational abstractions for the \DataMapperAction\ and related command logic.
src/Contracts · high confidence
New Foundation Base Classes for Actions, Factories, and Data Transfer Objects
The Foundation layer now introduces three new abstract base classes: Action, CreateNewFactory, and DataTransferObject. The DataTransferObject class provides a structured way to handle data transfer with features like array key resolution (snake\_case), exclusion of specific properties during serialization, and a 'recycle' method for creating modified copies. 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 standardized foundation for building actions, database factories, and data transfer objects within the application.
src/Foundation · high confidence
New ResolveCommandAction for command resolution
A new ResolveCommandAction class has been introduced to handle the resolution of commands. This class manages the process of checking for file existence and copying stubs, utilizing the existing FilePresentAction and CopyStubAction components to streamline command generation workflows.
src/Actions/Command · high confidence
Behavioural changes
Add FileAlreadyExistException for duplicate file conflicts
A new exception class, FileAlreadyExistException, has been introduced in the src/Exceptions directory. This change allows the application to explicitly handle scenarios where a file already exists, returning a 403 Forbidden status code to the user.
src/Exceptions · high confidence
Automatic PSR-4 autoloader registration for base structures
A new action, ResolveComposerAutoLoaderAction, has been introduced to automatically update the project's composer.json file. This action reads the configured 'diamond.structures' and ensures each corresponding namespace is added to the PSR-4 autoload section, preventing duplicate entries. This automates the process of registering new base directory structures for autoloading.
src/Actions/Composer · high confidence
Test coverage
Add unit tests for DataTransferObject functionality; Added tests for Application command generators; Added tests for DDD base structure and migration generation commands; Added tests for domain make commands; Added unit tests for Composer auto-loader resolution; Set up Pest testing infrastructure.
Dependencies
Initial package release with Laravel 11 and PHP 8.2 support
The project is now a fully functional Laravel package, introducing support for Laravel 11 alongside Laravel 10 and 9. It requires PHP 8.2 and integrates key Laravel components (support, console, filesystem, container) as dependencies, while adding testing tools like Pest and PHPStan to the development environment.
(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 (23)
- Dependency hygiene PARTLY measured — Composer dependencies read, no committed lock to grade for currency
- Documentation: no contributor guidance (README.md)
- Documentation: no installation or build instructions (README.md)
- Documentation: no usage examples (README.md)
- Duplicate Intent: CreateNewFactory (a Foundation class) and Factory (a Contract) both define resolveFactory(). It is unclear if CreateNewFactory is an implementation of Factory or a separate utility. If it is an implementation, it should implement the contract. If it is a separate utility, the naming is confusingly similar to the contract it likely relates to.
- 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 Resolution Method Naming: The HasOptions trait exposes resolveForceOption, resolveEventOption, and resolveModelOption. However, the HasArguments trait exposes resolveNameArgument. The FactoryContractMakeAction also exposes resolveForceOption and resolveNameArgument. While 'resolve' is consistent, the mix of specific option names in the trait vs. generic argument resolution suggests a lack of a unified 'Option Resolver' interface. Furthermore, InteractsWithConsoleInApplication has resolvePlaceholders while FactoryContractMakeAction also has resolvePlaceholders. This duplication across Actions and Commands suggests these concerns should be abstracted into a shared service or trait rather than duplicated in every command/action.
- Medium: security finding (details withheld)
- No dependency advisory monitoring
- …and 3 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/diamond-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 22 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-821afab8930d.