Skip to content

Instantly share code, notes, and snippets.

@roxblnfk
Created October 5, 2025 16:09
Show Gist options
  • Select an option

  • Save roxblnfk/cc30d68aa38eaecbc8342a42474229b5 to your computer and use it in GitHub Desktop.

Select an option

Save roxblnfk/cc30d68aa38eaecbc8342a42474229b5 to your computer and use it in GitHub Desktop.
Architectural Comparison of PHP Frameworks: Symfony, Laravel, Spiral, CodeIgniter, and Yii3

PSR Compliance: Detailed Standards Analysis

Critical difference for interoperability: Yii3 and Spiral lead with full PSR compliance. Symfony has excellent support with some bridges. Laravel has selective compliance. CodeIgniter has minimal compliance.

Comprehensive PSR Compliance Matrix

PSR Standard Symfony 7.3 Laravel 11 Spiral 3.15 CodeIgniter 4.6 Yii 3
PSR-1: Basic Coding ✅ Full ✅ Full ✅ Full ✅ Full ✅ Full
PSR-2/12: Coding Style ✅ Full (PSR-12) ✅ Full (PSR-12) ✅ Full (PSR-12) ⚠️ Mostly ✅ Full (PSR-12)
PSR-3: Logger ✅ Full (Monolog) ✅ Full ✅ Full (Monolog) ✅ Full ✅ Full
PSR-4: Autoloading ✅ Full ✅ Full ✅ Full ✅ Full ✅ Full (Composer)
PSR-6: Cache ✅ Full ⚠️ Adapters ⚠️ Supported ❌ Adapter pkg ✅ Supported
PSR-7: HTTP Messages ⚠️ Bridge ⚠️ Bridge Native ❌ Custom HTTP Native
PSR-11: Container ✅ Full (3.3+) ✅ Full ✅ Full ❌ Service Locator ✅ Full
PSR-14: Event Dispatcher ⚠️ Compatible ❌ Custom Full ❌ Custom Full
PSR-15: HTTP Handlers ⚠️ Bridges ❌ Custom Full ❌ Filters Full
PSR-16: Simple Cache ✅ Full ⚠️ Partial ✅ Full ❌ Adapter pkg ✅ Full
PSR-17: HTTP Factories ⚠️ Bridge ❌ Custom ✅ Full ❌ No Required
PSR-18: HTTP Client ✅ Full ❌ Custom (Guzzle) ✅ Supported ❌ CURLRequest ✅ Compatible

Legend:

  • ✅ Full = Native implementation
  • ⚠️ Bridge/Partial = Supported via bridges or partial
  • ❌ = Not compliant/custom implementation

Detailed Analysis by Framework

Symfony PSR Compliance: 9/12 Full, 3/12 Bridge

Strengths:

  • PSR-11 (Container): Native since version 3.3
  • PSR-3 (Logger): Monolog integration
  • PSR-6, PSR-16 (Cache): symfony/cache implements both
  • PSR-18 (HTTP Client): symfony/http-client native PSR-18

Requires bridges:

  • PSR-7 (HTTP): symfony/psr-http-message-bridge + nyholm/psr7
  • PSR-15 (Middleware): Via PSR-7 bridge + third-party bundles
  • PSR-14 (Events): Compatible but not strict PSR-14 interface

Philosophy: Prioritizes HttpFoundation (richer API than PSR-7) but provides bridges for interoperability.

Laravel PSR Compliance: 5/12 Full, 2/12 Partial, 5/12 Custom

Strengths:

  • PSR-1, PSR-2/12 (Coding): Laravel Pint enforces
  • PSR-3 (Logger): Built on PSR-3
  • PSR-4 (Autoloading): Full Composer PSR-4
  • PSR-11 (Container): Native implementation

Custom implementations:

  • PSR-7 (HTTP): Symfony HttpFoundation, not PSR-7
  • PSR-14 (Events): Custom event system
  • PSR-15 (Middleware): Custom middleware signature
  • PSR-18 (HTTP Client): Guzzle internally but doesn't expose PSR-18

Philosophy: "Developer experience over strict PSR compliance" - follows PSRs where beneficial, custom solutions where it improves DX.

Spiral PSR Compliance: 11/12 Full, 1/12 Supported

Exceptional compliance:

  • All HTTP-related PSRs native: PSR-7, PSR-15, PSR-17
  • PSR-11 (Container): Custom but fully compliant
  • PSR-14 (Events): Full implementation
  • PSR-16 (Cache): Native support
  • PSR-3 (Logger): Monolog integration

Marketing: "PSR-{3,4,7,11,12,14,15,16,17} compliant" (official docs)

Philosophy: PSR compliance as core architectural principle. Designed for interoperability.

CodeIgniter PSR Compliance: 4/12 Full, 1/12 Mostly, 7/12 Not Compliant

Strengths:

  • PSR-1 (Coding): Full
  • PSR-2/12 (Style): Mostly (not all recommendations)
  • PSR-3 (Logger): Full implementation
  • PSR-4 (Autoloading): Full Composer PSR-4

Not compliant:

  • PSR-6, PSR-16 (Cache): Separate adapter module (codeigniter4/cache)
  • PSR-7 (HTTP): "Does not strive for compatibility" (official stance)
  • PSR-11 (Container): Service Locator, not PSR-11
  • PSR-14 (Events): Custom Events system
  • PSR-15 (Middleware): Filters with different signature
  • PSR-17, PSR-18: No support

Philosophy: "Simplicity and performance over standard compliance". Lightweight footprint prioritized.

Yii 3 PSR Compliance: 10/12 Full, 2/12 Supported

Exceptional compliance - most compliant framework:

  • Complete rewrite for PSR compliance - key goal of Yii3
  • PSR-3, 4, 7, 11, 14, 15, 16: Full native implementations
  • PSR-17 (HTTP Factories): Required dependency (external implementation)
  • PSR-6, PSR-18: Supported/Compatible

Philosophy: Yii3 was completely rewritten with PSR compliance as primary goal. Dropped Yii2's custom patterns in favor of standards.

Interoperability: Practical Consequences

High PSR Compliance (Yii3, Spiral, Symfony):

  • ✅ Can use any PSR-compliant libraries directly
  • ✅ PSR-15 middleware from Packagist works without adaptation
  • ✅ PSR-14 event listeners interoperable
  • ✅ PSR-11 containers swappable
  • ✅ Easier integration with microservices (shared PSR interfaces)

Selective Compliance (Laravel):

  • ⚠️ Requires bridges for PSR-7/15 middleware
  • ⚠️ Custom event system - not interoperable with PSR-14
  • ✅ PSR-11 container allows some interoperability
  • ⚠️ Framework-specific implementations for many concerns

Minimal Compliance (CodeIgniter):

  • ❌ Difficult to use PSR-based libraries
  • ❌ No PSR-15 middleware support
  • ❌ Custom implementations for most components
  • ✅ Lightweight and simple for self-contained apps

Framework Recommendations by PSR Priority

Maximum PSR compliance and interoperability:

  1. Yii 3 (10/12 native) - best for greenfield projects
  2. Spiral (11/12) - best for performance + compliance
  3. Symfony (9/12 + bridges) - best for enterprise

Developer Experience prioritized:

  1. Laravel - best DX, largest ecosystem, accepts PSR trade-offs
  2. CodeIgniter - simplicity, minimal overhead
  3. Symfony - comprehensive features with good PSR support

Critical architectural trade-off:

PSR Compliance vs Developer Experience: Laravel sacrifices compliance for DX; Yii3/Spiral prioritize standards. The choice depends on whether interoperability with PSR ecosystem or framework-specific optimizations matter more for your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment