Skip to content

Commit

Permalink
[1.2] Custom Layers (#76)
Browse files Browse the repository at this point in the history
- adds support for custom layers
- refactor and finalize the application layer config
- refactor ddd generator internals
- adds ddd:config utility command
- adds custom object resolution via DDD::resolveObjectSchemaUsing()
- refactor test coverage

---------

Co-authored-by: JasperTey <[email protected]>
  • Loading branch information
jaspertey and jaspertey authored Nov 18, 2024
1 parent 3c73e2d commit 7f23d72
Show file tree
Hide file tree
Showing 93 changed files with 3,925 additions and 1,218 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ jobs:
run: composer show -D

- name: Execute tests
run: vendor/bin/pest
run: vendor/bin/pest --ci
43 changes: 27 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,42 @@ All notable changes to `laravel-ddd` will be documented in this file.

## [Unreleased]
### Breaking
- Stubs are now published to `/stubs/ddd/*` instead of `resources/stubs/ddd/*`. If you have ddd stubs published from a prior version, they should be relocated.
- Stubs are now published to `base_path('stubs/ddd')` instead of `resource_path('stubs/ddd')`. In other words, they are now co-located alongside the framework's published stubs, within a ddd subfolder.
- Published stubs now use `.stub` extension instead of `.php.stub` (following Laravel's convention).
- If you are using published stubs from pre 1.2, you will need to refactor your stubs accordingly.

### Added
- Ability to configure the Application Layer, to generate domain objects that don't typically belong inside the domain layer.
- Support for the Application Layer, to generate domain-specific objects that don't belong directly in the domain layer:
```php
// In config/ddd.php
'application' => [
'path' => 'app/Modules',
'namespace' => 'App\Modules',
'objects' => [
'controller',
'request',
'middleware',
],
'application_path' => 'app/Modules',
'application_namespace' => 'App\Modules',
'application_objects' => [
'controller',
'request',
'middleware',
],
```
- Added `ddd:controller` to generate domain-specific controllers in the application layer.
- Added `ddd:request` to generate domain-spefic requests in the application layer.
- Added `ddd:middleware` to generate domain-specific middleware in the application layer.
- Support for Custom Layers, additional top-level namespaces of your choosing, such as `Infrastructure`, `Integrations`, etc.:
```php
// In config/ddd.php
'layers' => [
'Infrastructure' => 'src/Infrastructure',
],
```
- Added config utility command `ddd:config` to help manage the package's configuration over time.
- Added stub utility command `ddd:stub` to publish one or more stubs selectively.
- Added `ddd:controller` to generate domain-specific controllers.
- Added `ddd:request` to generate domain-spefic requests.
- Added `ddd:middleware` to generate domain-specific middleware.
- Added `ddd:migration` to generate domain migrations.
- Added `ddd:seeder` to generate domain seeders.
- Added `ddd:stub` to list, search, and publish one or more stubs as needed.
- Added `ddd:stub` to manage stubs.
- Migration folders across domains will be registered and scanned when running `php artisan migrate`, in addition to the standard application `database/migrations` path.
- Ability to customize generator object naming conventions with your own logic using `DDD::resolveObjectSchemaUsing()`.

### Changed
- `ddd:model` now internally extends Laravel's native `make:model` and inherits all standard options:
- `ddd:model` now extends Laravel's native `make:model` and inherits all standard options:
- `--migration|-m`
- `--factory|-f`
- `--seed|-s`
Expand All @@ -39,10 +49,11 @@ All notable changes to `laravel-ddd` will be documented in this file.
- `--all|-a`
- `--pivot|-p`
- `ddd:cache` is now `ddd:optimize` (`ddd:cache` is still available as an alias).
- For Laravel 11.27.1+, the framework's `optimize` and `optimize:clear` commands will automatically invoke `ddd:optimize` and `ddd:clear` respectively.
- Since Laravel 11.27.1, the framework's `optimize` and `optimize:clear` commands will automatically invoke `ddd:optimize` (`ddd:cache`) and `ddd:clear` respectively.

### Deprecated
- Domain base models are no longer required by default, and `config('ddd.base_model')` is now `null` by default.
- Stubs are no longer published via `php artisan vendor:publish --tag="ddd-stubs"`. Instead, use `php artisan ddd:stub` to manage them.

## [1.1.3] - 2024-11-05
### Chore
Expand Down
Loading

0 comments on commit 7f23d72

Please sign in to comment.