Category: PHP

Quite a while ago I have implemented something called RouteBuilder(has been renamed to ViewBuider in the meantime) in Sulu, which - as the name suggests - makes use of the Builder pattern in order to create different routes in a Sulu application. In addition to the Builder pattern the Factory pattern was also used.

And the best thing is that the getRoute method of both builders still return a Route object, so we can still easily iterate over all available routes, and know how to handle them.

Another advantage is that the Builder object can also be passed as argument to other functions taking part in the object creation process.

Usually is said that the Builder pattern is great when you want to create an object in multiple steps.
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