Search by

pushinbr / pam-http-psr

DavidWilliamBalbino

PSR-7, PSR-15 and PSR-17 implementations for Pam.

Package info

github.com/push-in/pam-http-psr

pkg:composer/pushinbr/pam-http-psr

Statistics

Installs: 33

Dependents: 3

Suggesters: 2

Stars: 0

Open Issues: 0

v1.0.0 2026-08-22 23:55 UTC

This package is auto-updated.

Last update: 2026-11-17 16:24:30 UTC


README

pam-http-psr: PSR-7, PSR-15 and PSR-17 implementations for PAM, on the official PHP-FIG interfaces.

Bring PSR-7, PSR-15 and PSR-17 software to PAM HTTP.
Messages, factories and a middleware pipeline built on the official PHP-FIG interfaces, at an explicit interoperability boundary.

Packagist PHP 8.5 CI License

Install · Quick example · What is inside · Docs · Issues

Install

Inside a PAM project (for example one created with pam init my-api --template http):

pam composer require pushinbr/pam-http-psr

It pulls in psr/http-message 2.x, psr/http-factory, psr/http-server-handler and psr/http-server-middleware.

Quick example

<?php

declare(strict_types=1);

use Pam\Http\Psr7\Factory;
use Pam\Http\Psr15\Pipeline;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

$factory = new Factory();
$request = $factory->createServerRequest('GET', 'https://example.test/users/42');
$handler = new class($factory) implements RequestHandlerInterface {
    public function __construct(private readonly Factory $factory)
    {
    }

    public function handle(ServerRequestInterface $request): ResponseInterface
    {
        return $this->factory->createResponse(204)->withHeader('x-path', $request->getUri()->getPath());
    }
};

$response = (new Pipeline($handler))->handle($request);

Pipeline accepts a list of MiddlewareInterface instances or callables as its second argument and runs them in order before the handler.

What you can build

  • Running PSR-15 middleware in a PAM application
  • Adapting libraries that require PSR-7 values
  • Migrating existing PSR-based HTTP code incrementally
Role HTTP interoperability adapter
Execution path PHP-FIG PSR interfaces · PAM HTTP
This repository owns Request, response, middleware, and factory implementations
Boundary Not a server or router; conversion has a measurable boundary cost

What is inside

Namespace Classes Interfaces
Pam\Http\Psr7 Stream, Uri, ServerRequest, Request, Response, UploadedFile PSR-7
Pam\Http\Psr7 Factory PSR-17 (request, response, server request, stream, uploaded file, URI)
Pam\Http\Psr15 Pipeline PSR-15 RequestHandlerInterface

The public namespaces Pam\Http\Psr7 and Pam\Http\Psr15 are preserved from the earlier package names (see the changelog).

Docs

Part of the PAM ecosystem

PAM

PAM runs PHP natively on servers, desktops and phones. This repository is one piece of it.

PAM PAM Desktop PAM Native Ecosystem
the runtime and CLI native desktop apps in PHP native Android and iOS apps in PHP every official package and plugin

Docs: push-in.github.io/pam-docs · Issues

Apache License 2.0: use, modify and distribute for any purpose, including commercially · Made in Brazil by Pushin