Adapter: Convert the interface of a class into another interface that clients expect — making incompatible interfaces work together. The Adapter pattern wraps a class so it offers the interface your code expects. It is the software version of a travel plug: the socket and the plug stay the same, and the adapter sits in between.
You use it all the time when integrating external services. Your application defines a small interface, such as PaymentGateway with a charge() method. An adapter translates that into Mollie's or Stripe's specific API calls.
What should you keep in mind with Adapter?
The benefit shows up later. If you switch payment providers, you write one new adapter and leave the rest of the code alone. Testing also gets easier, because you can swap in a fake adapter that never contacts a real service. Keep adapters thin. They translate between two interfaces and should not contain business rules of their own.
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.