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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners