Proxy: Provide a surrogate that controls access to another object — add lazy initialisation, access control, logging, or caching transparently. The Proxy pattern puts a stand-in object in front of a real one. The proxy has the same interface, so callers do not notice, but it can add behaviour before or after passing calls through.
Typical uses are lazy loading, where an expensive object is only created when first used; access control, where the proxy checks permissions; caching, where repeated calls are answered without reaching the real object; and logging.
What should you keep in mind with Proxy?
You meet proxies often without naming them. ORMs use lazy-loading proxies for related records, and HTTP reverse proxies like Nginx apply the same idea at network level. In code, keep proxies thin and focused on one concern. If a proxy starts adding business rules, it has become something else and should be named accordingly.
Apply Spatie's Laravel and PHP coding standards for any task that creates, edits, reviews, refactors, or formats Laravel/PHP code or Blade templates; use for controllers, Eloquent models, routes, config, validation, migrations, tests, and related files to align with Laravel conventions and PSR-12.
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.