1.2.954. PSR-7 Usage

PSR-7 describes common interfaces for representing HTTP messages as described in RFC 7230 and RFC 7231, and URI for use with HTTP messages as described in RFC 3986.

It is supported by an set of interfaces, that one may use in the code.

<?php

namespace MyNamespace;

// MyServerRequest implements the PSR-7 ServerRequestInterface.
// MyServerRequest is more of a black hole than a real Server.
class MyServerRequest extends  \Psr\Http\Message\ServerRequestInterface  {
    public function getServerParams() {}
    public function getCookieParams() {}
    public function withCookieParams(array $cookies) {}
    public function getQueryParams() {}
    public function withQueryParams(array $query) {}
    public function getUploadedFiles() {}
    public function withUploadedFiles(array $uploadedFiles) {}
    public function getParsedBody() {}
    public function withParsedBody($data) {}
    public function getAttributes() {}
    public function getAttribute($name, $default = null) {}
    public function withAttribute($name, $value) {}
    public function withoutAttribute($name) {}
}

?>

See also PSR-7 : HTTP message interfaces.

1.2.954.1. Specs

Short name

Psr/Psr7Usage

Rulesets

All, Appinfo, CE

Exakat since

0.11.6

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

psr

Available in

Entreprise Edition, Community Edition, Exakat Cloud