phprise/http-request

Atomic repository for Requests of HTTP Connector based on the OTAKU Manifesto.

Installs: 1

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:project

pkg:composer/phprise/http-request

v1.0.0 2026-01-22 19:16 UTC

This package is auto-updated.

Last update: 2026-01-22 19:24:24 UTC


README

The Atomic Repository is the smallest possible unit of granularity. It enforces a strict architectural boundary through the following rules:

  1. No Subdirectories: Only one level of directory inside src/.
  2. Maximum 10 Files: Only 10 files per package.
  3. Strict Typing: Mandatory declare(strict_types=1) and full type hinting for all properties and methods.
  4. Object Calisthenics: Maximum of 50 lines per class and 2 instance variables to ensure extreme cohesion.
  5. Value Objects: All primitives must be wrapped. Raw strings or integers are not permitted in domain logic.
  6. First Class Collections: Arrays are forbidden for data transport; use dedicated Collection objects.
  7. Tell, Don't Ask: Getters and setters are prohibited. Objects must expose behavior, not state.
  8. Infrastructure Ignorance: The domain core is decoupled from persistence, frameworks, and external tools.
  9. Logic Flow: The else keyword is banned. Use guard clauses and early returns to minimize indentation.

Installation

Install the package via composer:

composer require phprise/http-request

Usage

This repository contains specialized HTTP request objects. It is an Atom of the HTTP system, designed to handle the structure of different HTTP methods with strict typing and immutability.

Specialized Requests

Instead of generic requests, use specialized classes that enforce the correct HTTP method and structure.

Store (POST)

Used for creating resources. Requires a URI and a TransferObjectInterface payload.

use Phprise\Http\Request\StoreRequest;
use Phprise\Http\ValueObject\Uri;

$request = new StoreRequest(
    new Uri('https://api.example.com/users'),
    $userDto
);

echo $request->getMethod(); // POST

Update (PATCH) / Replace (PUT)

Used for modifying resources.

use Phprise\Http\Request\UpdateRequest;

$request = new UpdateRequest($uri, $patchDto);
echo $request->getMethod(); // PATCH

List (GET) / Show (GET)

Used for retrieving resources.

use Phprise\Http\Request\ListRequest;

$request = new ListRequest($uri);
echo $request->getMethod(); // GET

Request Context

All requests wrap a RequestContext, allowing you to immutably modify headers or protocol versions while maintaining the specialized request type.

$request = $request->withHeader('X-Custom', 'Value');

Note

This atom segregates request logic from the actual transmission (Connector), ensuring that request structure is defined by the domain's needs.

Philosophy

We follow The OTAKU Manifesto: Fluid Structure Design.

  1. O - Own your Discipline (Be strict with yourself)
  2. T - Tools for Composition (Compose like Unix)
  3. A - Armor the Core (Protect the heart of the business)
  4. K - Keep Infrastructure Silent (Infrastructure is just a detail)
  5. U - Universal Language & Contracts (Speak the user's language via clear contracts)

Please read more about it in PHILOSOPHY.md.

License

MIT License

Free to use, modify, and distribute.