modules to be developed independently • Allow modules to own all of their data • Empower teams to work in parallel • Decrease surface area and blast radius of changes
$id, public string $email ) {} } class TokenIssuer { public function issue(int $uniqueIdentifier): Token { / / some magic return new Token($payload); } } $user = new App\User('Mateus', '[email protected]'); $token = (new App\Auth\TokenIssuer) -> issue($user -> id);
$id, public string $email ) {} } class TokenIssuer { public function issue(int $uniqueIdentifier): Token { / / some magic return new Token($payload); } } $user = new App\User('Mateus', '[email protected]'); $token = (new App\Auth\TokenIssuer) -> issue($user -> id);
$id, public string $email ) {} } class TokenIssuer { public function issue(int $uniqueIdentifier): Token { / / some magic return new Token($payload); } } $user = new App\User('Mateus', '[email protected]'); $token = (new App\Auth\TokenIssuer) -> issue($user -> id);
modules to be developed independently • A module should not know about other module’s internals • Incoming messages should be translated into something meaningful to the module’s domain • The producer can have contracts redirect their implementation without the consumer ever being aware
• Always try to expose a small, well-defined public API • Modules allow and encourage you to employ different strategies for different problems. Use that!
hold your modules (e.g \Modules) • Leverage Service Providers to set up everything related to the module: views, config files, routes, etc • Think about whether a module should hold all of its data or not • Leverage the Event Bus to pass messages between different modules