Skip to content

pwm/sfw-request

Repository files navigation

SFW Request

Build Status codecov Maintainability Test Coverage License: MIT

A simple Request object for JSON APIs.

Table of Contents

Requirements

PHP 7.1+

Installation

composer require pwm/sfw-request

Usage

// Create request
$request = new Request(
    new DateTimeImmutable(),
    $_SERVER['CONTENT_TYPE'],
    $_SERVER['REQUEST_METHOD'],
    $_SERVER['REQUEST_URI'],
    $_GET,
    file_get_contents('php://input')
);

// Access properties
$time = $request->getTime();
$contentType = $request->getContentType();
$method = $request->getMethod();
$uri = $request->getUri();
$query = $request->getQuery();
$json = $request->getJson();

How it works

TBD

Tests

$ vendor/bin/phpunit
$ composer phpcs
$ composer phpstan

Changelog

Click here

Licence

MIT

About

A simple Request object for JSON APIs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages