Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.2] Official Release #77

Merged
merged 5 commits into from
Nov 23, 2024
Merged

[1.2] Official Release #77

merged 5 commits into from
Nov 23, 2024

Conversation

jaspertey
Copy link
Member

@jaspertey jaspertey commented Nov 18, 2024

Preparing to merge the final 1.2 release into main.

To use this version now:

composer require lunarstorm/laravel-ddd:dev-next 

Upgrade guide: https://github.com/lunarstorm/laravel-ddd/blob/next/UPGRADING.md

Breaking

  • 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

  • Support for the Application Layer, to generate domain-specific objects that don't belong directly in the domain layer:
    // In config/ddd.php
    'application_path' => 'app/Modules',
    'application_namespace' => 'App\Modules',
    'application_objects' => [
        'controller',
        'request',
        'middleware',
    ],
  • Support for Custom Layers, additional top-level namespaces of your choosing, such as Infrastructure, Integrations, etc.:
    // 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 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 extends Laravel's native make:model and inherits all standard options:
    • --migration|-m
    • --factory|-f
    • --seed|-s
    • --controller --resource --requests|-crR
    • --policy
    • -mfsc
    • --all|-a
    • --pivot|-p
  • ddd:cache is now ddd:optimize (ddd:cache is still available as an alias).
  • 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.

Resolves #61

jaspertey and others added 4 commits October 22, 2024 08:43
* WIP experimentation

* Fix styling

* Refactor OverridesHandle to HandleHooks

* Fix styling

* WIP

* WIP: Refactoring ddd:model, generate application layer objects, and more.

* Fix styling

* Replace HasFactory with HasDomainFactory.

* Fix styling

* Normalize paths for tests on Windows.

* Keep phpstan happy.

* Fix styling

* Add header block.

* Remove stray methods.

* Update readme.

* Further refinements and WIP.

* Update change notes.

* Fix phpstan issue.

* Fix test.

* Normalize paths for windows.

* Support application layer paths outside app folder.

* Add peer dependencies section.

* Document the Application Layer.

* Update wording.

* Minor wording.

* Support optimize commands in Laravel 11.27.1

* Update cache tests.

* Ensure optimize:clear after each test.

* Update internals and implement custom namespace resolving.

* Apply namespace resolver to all types.

* Refactor cache/optimize commands.

* Minor changes.

* Wrap command column with backticks.

* Simplify ddd.application_layer to ddd.application

* Fix styling

* Update readme/config wordings.

---------

Co-authored-by: JasperTey <[email protected]>
* Updates:
- normalize domain stub trait across all domain generators
- ensure ddd:controller is able to check for base controller existence
- refine ddd:model stub replacements

* Introduce ddd:publish and ddd:stub commands.

* Normalize the resolution of published stubs.

* Ensure post-build replacements are skipped in ddd:model when using custom stubs.

* Implement ddd:publish and ddd:stub commands.

* Refinements to readme and stub documentation.

---------

Co-authored-by: JasperTey <[email protected]>
- 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]>
@jaspertey jaspertey marked this pull request as ready for review November 18, 2024 02:47
@jaspertey
Copy link
Member Author

jaspertey commented Nov 18, 2024

Hey @pelmered, FYI: the 1.2 implementation has been finalized, and I was able to refactor the internals to support your customization scenario fully. See: https://github.com/lunarstorm/laravel-ddd/tree/next?tab=readme-ov-file#custom-object-resolution

The new Custom Layer support will also allow you to interact with your other layers: src/Integrations and src/Support.

Would be great if you're able to test things out and provide any final feedback before this goes live.

composer require lunarstorm/laravel-ddd:dev-next 

When upgrading, the existing ddd.php config file can be auto-updated and rebuilt using php artisan ddd:config update. See Upgrade Notes.

If all goes well, I hope to merge and tag the official 1.2.0 release sometime this week!

@pelmered
Copy link
Contributor

Hey @pelmered, FYI: the 1.2 implementation has been finalized, and I was able to refactor the internals to support your customization scenario fully. See: https://github.com/lunarstorm/laravel-ddd/tree/next?tab=readme-ov-file#custom-object-resolution

The new Custom Layer support will also allow you to interact with your other layers: src/Integrations and src/Support.

Would be great if you're able to test things out and provide any final feedback before this goes live.

composer require lunarstorm/laravel-ddd:dev-next 

When upgrading, the existing ddd.php config file can be auto-updated and rebuilt using php artisan ddd:config update. See Upgrade Notes.

If all goes well, I hope to merge and tag the official 1.2.0 release sometime this week!

Awesome! Thank you.
I tested Beta-2 a bit last week and it worked great except for that the Application layer files that I had to move manually as expected. I will update to Beta 3 now. I don't think I need any new models created this week, but I will configure this and test a bit.

- ensure injected base controller import isn't separated from other imports
- resolve issues with laravel 10 compatibility
@jaspertey jaspertey merged commit 08a6ebb into main Nov 23, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants