Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Framework X Laravel Package

clue/framework-x

Framework X is a simple, fast micro framework for building reactive PHP web apps. Create routes, return PSR-7 responses, and run anywhere—behind a traditional web server or as a standalone server with ReactPHP under the hood.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Reactive Micro-Framework: Framework X is a lightweight, reactive micro-framework built on ReactPHP, making it ideal for event-driven, async PHP applications (e.g., WebSockets, real-time APIs, or high-concurrency services). It aligns well with Laravel’s modularity but targets a different use case—low-level control over HTTP requests/responses rather than Laravel’s full-stack abstractions.
  • PSR-15 Middleware: Supports PSR-15 middleware, enabling seamless integration with Laravel’s middleware stack (e.g., CORS, auth) via adapters.
  • Fiber/Generator Support: Leverages PHP fibers (8.1+) or generators for coroutines, offering non-blocking I/O—complementary to Laravel’s synchronous model but requiring architectural adjustments.
  • Dependency Injection (DI): Built-in DI container (similar to Laravel’s) but with manual/autowiring flexibility, which may require custom binding logic for Laravel’s service providers.

Integration Feasibility

  • Laravel as a Backend: Framework X could serve as a high-performance backend for Laravel’s frontend (e.g., Blade, Livewire) via:
    • API Layer: Replace Laravel’s routing for async endpoints (e.g., WebSocket handlers, long-polling).
    • Hybrid Setup: Use Framework X for real-time features while keeping Laravel for traditional HTTP routes (via reverse proxy like Nginx).
  • Shared Dependencies: Both use Composer, but Framework X relies on ReactPHP (event loop, HTTP components), which Laravel does not natively support. Conflict risk is low if isolated.
  • Database/ORM: Framework X lacks an ORM; Laravel’s Eloquent would need to be manually integrated (e.g., via async DB drivers like react/pdo).

Technical Risk

  • Paradigm Shift: Laravel’s synchronous, request-response model clashes with Framework X’s reactive, event-driven approach. Key risks:
    • State Management: Laravel’s session/cookie handling assumes synchronous execution; Framework X requires explicit async storage (e.g., Redis).
    • Middleware Ordering: PSR-15 middleware must be reordered for async compatibility (e.g., auth middleware may need fiber-aware logic).
    • Testing: Laravel’s built-in testing (PHPUnit/BrowserKit) won’t work directly; ReactPHP’s test utilities (e.g., Loop) would be needed.
  • Performance Tradeoffs:
    • Cold Starts: Fibers/generators add overhead for simple requests; benchmark against Laravel’s native routing.
    • Memory: Event loops may increase memory usage under high load (monitor with react/debug).
  • Ecosystem Gaps:
    • No Laravel-specific integrations (e.g., Horizon queues, Scout search).
    • Validation: Laravel’s Illuminate/Validation would need to be adapted for async (e.g., fiber-safe rules).

Key Questions

  1. Use Case Justification:
    • Why use Framework X instead of Laravel’s Laravel Echo (for WebSockets) or Laravel Livewire (for reactivity)?
    • Is the goal performance-critical async endpoints or a full framework replacement?
  2. Architecture Design:
    • How will Laravel’s service container interact with Framework X’s DI? (Custom bindings or a bridge?)
    • Will sessions/auth be shared between both frameworks? If so, how?
  3. Deployment Complexity:
    • Can Framework X run side-by-side with Laravel (same process or separate)? If separate, how will they communicate (e.g., Redis pub/sub)?
    • Will this require custom Docker/Nginx configurations for routing?
  4. Team Ramp-Up:
    • Does the team have ReactPHP experience? If not, what’s the training plan?
    • How will debugging work (e.g., Xdebug with fibers, ReactPHP’s Loop::run())?

Integration Approach

Stack Fit

  • Core Stack:
    • PHP 8.1+: Required for fibers; Laravel 9+ supports this.
    • ReactPHP: Framework X’s dependency. Laravel does not use this, so it must be isolated (e.g., separate Composer require-dev or monorepo).
    • PSR-15 Middleware: Laravel’s middleware can be adapted via Laminas\Stratigility or custom wrappers.
  • Shared Components:
    • Routing: Framework X routes can proxy to Laravel for traditional HTTP (e.g., /api/* → Laravel, /ws/* → Framework X).
    • Validation: Use shared validation rules but run them in fibers (e.g., Validator::validate() wrapped in Fiber).
    • Logging: Both support PSR-3 logging; configure a single handler (e.g., Monolog).

Migration Path

  1. Phase 1: Proof of Concept
    • Spin up a minimal Framework X app alongside Laravel (same project or separate).
    • Test basic routing (e.g., /ws → Framework X, /api → Laravel).
    • Implement shared middleware (e.g., CORS) using PSR-15 adapters.
  2. Phase 2: Async Endpoints
    • Replace blocking Laravel routes with Framework X for async tasks (e.g., WebSockets, SSE).
    • Example: Move Laravel’s Broadcast logic to Framework X’s EventEmitter.
  3. Phase 3: Hybrid Integration
    • Use Laravel’s service container to inject Framework X dependencies (e.g., DB connections via react/pdo).
    • Implement cross-framework auth (e.g., Laravel’s session stored in Redis, accessed by Framework X).
  4. Phase 4: Full Reactive Layer
    • Migrate real-time features (e.g., notifications, live updates) entirely to Framework X.
    • Use Laravel’s queues (e.g., Horizon) to trigger Framework X events.

Compatibility

Component Laravel Framework X Integration Strategy
Routing PSR-7 + Laravel Router PSR-15 + ReactPHP Reverse proxy or shared router layer
Middleware PSR-15 (Laravel-specific) PSR-15 Adapter layer (e.g., Laminas\Stratigility)
Validation Illuminate/Validation Manual or PSR-15 Shared rules, async execution
Database Eloquent/Query Builder ReactPHP PDO Async DB drivers (e.g., react/pdo)
Sessions File/Database/Redis Manual (e.g., Redis) Shared Redis store with async access
Queues Horizon/Redis ReactPHP EventLoop Trigger Framework X events via Laravel queues
WebSockets N/A Built-in (ReactPHP) Replace Laravel Echo with Framework X

Sequencing

  1. Isolate Framework X:
    • Start with a separate Composer project to avoid dependency conflicts.
    • Use Docker to test side-by-side deployment.
  2. Shared Infrastructure:
    • Set up shared Redis for sessions/auth.
    • Configure Nginx to route /ws to Framework X and /api to Laravel.
  3. Gradual Migration:
    • Move non-critical async endpoints first (e.g., WebSocket ping).
    • Replace blocking API routes with Framework X as confidence grows.
  4. Monitoring:
    • Add ReactPHP’s Loop::addPeriodicTimer() for health checks.
    • Use Laravel Telescope + ReactPHP metrics (e.g., react/debug).

Operational Impact

Maintenance

  • Dependency Management:
    • Framework X’s ReactPHP dependencies must be version-locked to avoid conflicts with Laravel’s symfony/http-foundation.
    • Use Composer scripts to run both frameworks’ test suites.
  • Error Handling:
    • Framework X’s custom error pages may conflict with Laravel’s. Use shared error handlers (e.g., JSON responses for APIs).
    • Fiber-specific errors (e.g., unhandled exceptions in fibers) require custom logging (e.g., React\Promise\Timer\TimeoutException).
  • Updates:
    • Framework X’s frequent releases (e.g., PHP 8.4 support) may require parallel Laravel updates.
    • ReactPHP’s breaking changes (e.g., Promise v3) need testing.

Support

  • Debugging:
    • Xdebug with Fibers: Requires xdebug.mode=fiber (PHP 8.1+).
    • ReactPHP Tools: Use react/debug
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views