Design Patterns Are Everywhere in Laravel. The Artisan of the Day is Mary Perry.

Design Patterns Are Everywhere in Laravel. The Artisan of the Day is Mary Perry.

Design Patterns Are Everywhere in Laravel. The Artisan of the Day is Mary Perry.

When it comes to finding the poetry hidden in Laravel's architecture, Mary Perry sees what others miss.

Mary is a self-taught developer from Scranton, Pennsylvania, who doesn't work with Laravel professionally day-to-day but fell in love with the community at her first Laracon two years ago.

She's enthusiastic about databases, finding design patterns in code architecture, and "liking things." You've probably seen her on social media celebrating projects she thinks are cool. She's also been quietly contributing to the Laravel ecosystem and helping other developers understand complex architectural concepts.

Her handle is @sifrious, derived from the Arabic root "sifr" meaning zero or nothing. It's a concept that perfectly captures her nuanced thinking about how true and false don't always satisfy every case in real-world development.

Mary embodies the curious spirit of Laravel: diving deep not because you have to, but because the elegance is worth understanding. Her first major conference talk at Laracon was equal parts technical, philosophical, playful, and packed with puns that had the entire community tweeting (including other conference speakers).

Design Patterns in Laravel: Revealing Laravel's Hidden Poetry

At Laracon, Mary took us on a tour through Laravel's request lifecycle and showed us that the framework we love is actually a masterclass in design patterns. We just didn't need to know their names to benefit from them.

What Mary revealed about Laravel's architecture:

  • Singleton everywhere: The Laravel application itself is a singleton, ensuring only one instance exists throughout the request lifecycle. It's clean, simple, effective.

  • Factory magic: Session managers, database handlers, and service creation all use factory patterns. You get "one of a group of products" without knowing which one until a request initiates the container.

  • Facades as encapsulation: Not just static access, but thoughtful complexity hiding. "A facade, in a word, is encapsulation," making complex systems like the Laravel service container simple to interact with.

  • Dependency injection mastery: Laravel uses all four varieties of inversion of control, with the service container resolving dependencies so elegantly you never experience dependency hell.

  • Builder pattern in middleware: The kernel acts as director, building complex request objects through the middleware pipeline, with each middleware as a concrete builder.

  • Iterator pattern in collections: Route collections (and Laravel collections in general) use the iterator pattern, giving you cursor-like functionality that database enthusiasts will appreciate.

  • Strategy pattern everywhere: Controllers, middleware, session managers all using strategy patterns for flexible, decoupled behavior.

  • Command pattern in actions: Turning behaviors into first-class objects that can be parameterized, logged, and even undone.

  • Observer pattern in Eloquent: Model observers watching for state changes, updating other objects when things happen.

Mary's key insight is that Laravel is already solving design pattern problems for you. The productivity comes from capturing design experience so effectively that "you don't really have to think about it." You're benefiting from other people's mistakes and expertise, shipping faster while avoiding footguns.

Her final wisdom: "Learn the names or don't. The right tool, architecture, and implementation are always specific to what you're building." But whatever you're building, talk about it because sharing and celebrating good work makes everyone's life better.

Mary ended with a blessing: "Laravel Forever." The room erupted in applause. Like TJ Miller with Prism, Mary represents the best of the Laravel Community: developers who make complex concepts feel Laravel-native and help us all understand the elegance that's been there all along.

Your Story Belongs Here

You don't need to have a course, a talk, or a big launch. If Laravel has been part of your journey (a pivot, a side project, a moment of growth), we'd love to hear about it!

Answer Taylor's questions at laravel.com/stories.

We're always looking to feature developers from every corner of the community. Beginners, builders, behind-the-scenes folks. If Laravel helped you do something you're proud of, that's a story worth telling.

Keep reading

Stay connected with the latest Laravel news