PHP code example of tourze / http-forward-bundle

1. Go to this page and download the library: Download tourze/http-forward-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tourze / http-forward-bundle example snippets


use Tourze\HttpForwardBundle\Service\ForwarderService;
use Tourze\HttpForwardBundle\Entity\ForwardRule;

class YourController
{
    public function __construct(
        private readonly ForwarderService $forwarderService,
    ) {}

    public function proxy(Request $request, ForwardRule $rule): Response
    {
        return $this->forwarderService->forward($request, $rule);
    }
}

// Add multiple Backends to ForwardRule in EasyAdmin
// System will automatically round-robin among healthy backends

// Enable stream_enabled in ForwardRule
// Or request with Accept: text/event-stream