Design Patterns in Laravel on a Real Project

A series about design patterns through real ICanUp cases. Instead of a pattern encyclopedia, each article starts with a concrete architectural problem where Pipeline, Observer, Registry, Strategy, Factory, Template Method, or Adapter became a natural solution.

Design Patterns in Laravel on a Real Project
laravel-observer-content-block-search-text-cover.png
Laravel

Laravel Observer in Practice: Keeping search_text in Sync with ContentBlock.data

In ICanUp, I added a derived search_text field to ContentBlock for search. The harder problem was not extracting text, but guaranteeing that search_text always matches the current data regardless of which service, command, importer, or future code saves the model. This article shows why a saving Observer fits the invariant, why extraction remains in a separate class, and why existing records still need a backfill.

167
registry-pattern-laravel-content-blocks-without-giant-switch-cover.png
Laravel

Registry Pattern in Laravel: Adding Content Blocks Without a Giant Switch

The ICanUp Page Builder grew from simple Paragraph and Image blocks to Hero, Cards, FAQ, Forms, Model Collection, and scoped blocks. This article shows how the Registry Pattern collects definitions behind one contract, resolves the right implementation by type, and lets the system grow without one giant switch.

158
template-method-laravel-one-algorithm-different-content-blocks-cover.png
Laravel

Template Method in Laravel: One Algorithm for Different Content Blocks

Hero, CTA, Highlight, Cards, Steps, and FAQ have different data but share the same defaults, validation, and configuration structure. This article shows how AbstractPresentationBlockDefinition fixes the common algorithm while concrete definitions provide only their own hooks.

119
adapter-pattern-laravel-indexnow-http-api-cover.png
Laravel

Adapter Pattern in Laravel: Isolating an External HTTP API Behind IndexNowClientInterface

Прикладний шар ICanUp має лише передати список публічних URL і не знати нічого про endpoint, API key, формат HTTP-запиту чи Laravel Http facade. У статті я показую, як `IndexNowClientInterface` став портом для прикладного коду, а `IndexNowHttpClient` адаптує цей простий контракт до зовнішнього API IndexNow.

122