References Getting Started Getting Started Architecture Architecture Application Application Window Window WebView WebView Deployment Deployment Components Components Framework Integrations Framework Integrations Examples Examples Community Community github GitHub github Get Started arrow_up_right
Getting Started Getting Started Architecture Architecture Application Application Window Window WebView WebView Deployment Deployment Components Components Framework Integrations Framework Integrations Examples Examples Community Community

Framework Integrations

Symfony HTTP Adapter Laravel HTTP Adapter PSR HTTP Adapter Getting Started Architecture Application Window WebView Deployment Components Framework Integrations Examples Community

PSR HTTP Adapter

The PSR HTTP Bridge provides the ability to convert internal requests and responses of the Schema API to those compatible with any PSR-7 compatible frameworks (e.g. Yii3, Spiral, Slim, etc.).

This bridge is NOT included by default in the boson-php/runtime and must be installed separately.

Installation

Via Composer:

composer require boson-php/psr-http-bridge

Requirements:

  • PHP ^8.4
  • psr/http-message ^1.0|^2.0
  • psr/http-factory ^1.0

Usage

To work with any PSR-7/17-compatible framework, you are provided with a corresponding adapter Boson\Bridge\Psr\Http\Psr7HttpAdapter.

use Boson\Application;
use Boson\ApplicationCreateInfo;
use Boson\Bridge\Psr\Http\Psr7HttpAdapter;
use Boson\WebView\Api\Schemes\Event\SchemeRequestReceived;

// Create an application
$app = new Application(new ApplicationCreateInfo(
    schemes: [ 'psr7' ],
));

// Create PSR-7 HTTP adapter
$psr7 = new Psr7HttpAdapter(
    requests: new YourVendorPsr17ServerRequestFactory(),
);

// Subscribe to receive a request
$app->on(function (SchemeRequestReceived $e) use ($psr7): void {
    $psr7Request = $psr7->createRequest($e->request);
    
    // ...do something, like:
    // 
    // $psr7Response = $app->handle($psr7Request);
    //
    
    $e->response = $psr7->createResponse($psr7Response);
});

$app->webview->url = 'psr7://app/example';
github discord telegram Get started Documentation Contribution Guide License Release Notes BOSON PHP © 2025. All Rights Reversed.