Category: Laravel, PHP, api

I've picked Chapter 11, which gives a compact overview of all the design patterns that are useful for structuring your web application in a way that will (almost) automatically make it independent of surrounding infrastructure, including the web framework you use.

In Part I we've been discovering these design patterns by refactoring different areas of a simple web application.

Verify that the requested change is possible given the current state of the entity, and that the entity won't end up in an invalid state: When an update to a particular field actually represents an action performed on the object, define a method for it.

The next time the application tries to save() an entity you look it up in the identity map.

This application service should then follow the standard pattern of retrieving an entity, making a change to it, and saving it again.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners