Skip to content

Restructure package into a DDD module - #4

Merged
Shifrin merged 1 commit into
mainfrom
issue-3-refactor-proper-ddd-module
Oct 18, 2026
Merged

Shifrin merged 1 commit into
mainfrom
issue-3-refactor-proper-ddd-module

Conversation

@Shifrin

@Shifrin Shifrin commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Move the three sub-contexts (Identity, Authentication, Authorization) under src/Context/* and update all namespaces to Webify\User\Context*.

Relocate application-layer use cases (RegisterUser, OpenSession, VerifyChallenge, AssignRole, CreateRole, etc.) and strategies out of Domain/Service into Application/, where use cases that orchestrate repositories, hashers, ID generators, and event publishers belong.

Consolidate value objects that were duplicated and had diverged across contexts into the shared kernel (src/Domain): UserId, UserStatus, and PasswordHash. Add UserStatus::Unverified and remove the now-redundant Authentication copies and UserStatusTranslator.

Give the ExtensionInterface entry point a home in
src/Infrastructure/Extension/UserExtension and add per-context ServiceDefinitions.

Also:

  • Wire a PHPat DomainSpecification into PHPStan (raised to level 10)
  • Mirror the src/ layout in test/Unit and add UserExtensionTest

Move the three sub-contexts (Identity, Authentication, Authorization) under
src/Context/* and update all namespaces to Webify\User\Context\*.

Relocate application-layer use cases (RegisterUser, OpenSession,
VerifyChallenge, AssignRole, CreateRole, etc.) and strategies out of
Domain/Service into Application/, where use cases that orchestrate
repositories, hashers, ID generators, and event publishers belong.

Consolidate value objects that were duplicated and had diverged across
contexts into the shared kernel (src/Domain): UserId, UserStatus, and
PasswordHash. Add UserStatus::Unverified and remove the now-redundant
Authentication copies and UserStatusTranslator.

Give the ExtensionInterface entry point a home in
src/Infrastructure/Extension/UserExtension and add per-context
ServiceDefinitions.

Also:
- Wire a PHPat DomainSpecification into PHPStan (raised to level 10)
- Mirror the src/ layout in test/Unit and add UserExtensionTest
- Add docs/refactor.md documenting the refactor and composer.local.json

Signed-off-by: Mohammed Shifreen <mshifreen@gmail.com>
@Shifrin

Shifrin commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

The pr-check failed due to unit tests failure because some classes which comes from the base extension were missing and it expected because the base extension needs to be pushed it's latest changes. So this can be merged.

@Shifrin
Shifrin merged commit f15ef24 into main Oct 18, 2026
1 check failed
@Shifrin
Shifrin deleted the issue-3-refactor-proper-ddd-module branch October 18, 2026 11:25
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.

Refactor: Restructure ext-user into a proper DDD module with src/Context/*

1 participant