seniorPHP

Explain advanced API composition patterns (API Gateway vs BFF vs GraphQL federation) in PHP architectures.

Updated May 24, 2026

Short answer

API composition patterns define how multiple backend services are aggregated into client-facing APIs using Gateway, BFF, or GraphQL federation approaches.

Deep explanation

As PHP systems evolve into microservices, clients rarely consume a single service directly. Instead, APIs must be composed from multiple services.

  1. API Gateway
  • Single entry point
  • Handles routing, auth, rate limiting
  • Can do basic aggregation
  1. BFF (Backend for Frontend)
  • Dedicated backend per client (web/mobile)
  • Optimized responses per UI needs
  • Reduces over-fetching
  1. GraphQL Federation
  • Schema composed across services
  • Clients request exactly what they need
  • Strong typing across distributed services…

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More PHP interview questions

View all →