Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.
/ sapi-host Public archive
forked from narrowspark/http-emitter

(unmaintained - use narrowspark/http-emitter instead) SAPI host for dispatch of PSR-15 Handlers

License

Notifications You must be signed in to change notification settings

kodus/sapi-host

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kodus/sapi-host

Archived / Abandoned

This library implements a SAPI host for dispatch of PSR-15 HandlerInterface.

This project is work in progress.

Originally a fork of Daniel Bannert's narrowspark/http-emitter package, this package takes a different approach, internally leveraging Tobias Nyholm's nyholm/psr7-server package to bootstrap the incoming PSR-7 Request.

The philosophy of this package is that hosting a single handler, for a single request, should be a single operation.

Usage

To bootstrap a SapiHost, you need to pick a PSR-7 and PSR-17 implementation - for example, nyholm/psr7-server supports both, and you can install it with:

composer require nyholm/psr7-server

You need to have your PSR-15 handler implementation to dispatch, and then, for example, dispatch it from an index.php file, as follows:

<?php

use Kodus\Http\SapiHost;
use Nyholm\Psr7\Factory\Psr17Factory;

$factory = new Psr17Factory();

$host = new SapiHost(
    $factory,
    $factory,
    $factory,
    $factory,
    $factory
);

$host->dispatch(new YourRequestHandler());

Note that Psr17Factory implements all of the required PSR-17 factory interfaces.

About

(unmaintained - use narrowspark/http-emitter instead) SAPI host for dispatch of PSR-15 Handlers

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%