PHPackages                             sugatasei/bredala-http - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. sugatasei/bredala-http

ActiveLibrary[HTTP &amp; Networking](/categories/http)

sugatasei/bredala-http
======================

PHP object-oriented layer for the HTTP specification

3.1.1(1y ago)023MITPHPPHP &gt;=8.1.0

Since Aug 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sugatasei/bredala-http)[ Packagist](https://packagist.org/packages/sugatasei/bredala-http)[ RSS](/packages/sugatasei-bredala-http/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)DependenciesVersions (10)Used By (0)

bredala-http
============

[](#bredala-http)

PHP object-oriented layer for the HTTP specification.

Request
-------

[](#request)

`Bredala\Http\Request` helps to get HTTP request informations.

### Server info

[](#server-info)

- `servers(): array` Returns an array of server params.
- `server(string $name)` Returns a server params.
- `time(): int` Returns the request time in seconds
- `mtime(): float` Returns the request time in seconds with more precision

### HTTP method

[](#http-method)

`method(): string` Request method (CLI, GET, POST, DELETE, ...). `isGet(): bool` Returns HTTP request's is using GET method. `isPost(): bool` Returns HTTP request's is using POST method. `isPatch(): bool` Returns HTTP request's is using PATCH method. `isDelete(): bool` Returns HTTP request's is using DELETE method. `isClient(): bool` Returns HTTP request's is using GET method. `isAjax(): bool` Returns if the current request is an ajax request. `isSecure(): bool` Returns if the request is using the HTTPS protocol. ` uri(): string` Returns the request URI.

### HTTP Headers

[](#http-headers)

- `cookies()` Returns an array of cookies.
- `cookie(string $name)` Returns a cookie value.

### Request data

[](#request-data)

- `queryParams(): array` Returns an array of query params.
- `queryParam(string $name)` Returns a query value.
- `bodyParams(): array` Returns an array of form/json params.
- `bodyParam(string $name)` Returns a form/json value.
- `attachements(): array` Returns an array of uploaded files indexed by field name.
- `attachement(string $name): array` Returns an uploaded files.

### Client

[](#client)

- `userAgent(): string` Returns the user agent.
- `ip(): string` Returns the IP Address.

Response
--------

[](#response)

`Bredala\Http\Response` helps to send HTTP response.

- `reset(): mixed` Reset the response.

### HTTP status

[](#http-status)

- `getProtocolVersion(): string` Returns HTTP protocole version.
- `setStatusCode(int $code, ?string $reason = null): static` Sets HTTP status. If reason is null, a default reason corresponding to the HTTP status code is set.

### HTTP headers

[](#http-headers-1)

- `getHeaders(): array` Returns HTTP headers
- `setHeader(string $name, string $value): static` Sets HTTP header.
- `addHeader(string $name, string $value): static` Adds HTTP header. Userfull for headers with multiple values.
- `removeHeader(string $name): static` Removes HTTP header
- `setContentType(string $mime, string $charset = "UTF-8"): static` Sets content-type. File extension can be used for most of them. ```
    $res->setContentType('jpg');
    $res->setContentType('image/jpeg');
    ```
- `addCookie(string $name, $value, int $expire = 0, $settings = []): static` Adds a cookie.
- `removeCookie(string $name): static` Removes cookie.
- `redirect(string $url = "/", bool $temporary = true): static` HTTP redirection.
- `cache(int $age = 86400): static` Sets HTTP cache.
- `noCache(): static` Forces HTTP no-cache.
- `cors(?string $origin = null, ?string $method = null): static` Enables CORS.

### Http body

[](#http-body)

`getBody(): Bredala\Http\Stream` Returns body. `setBody(Bredala\Http\Stream|string $body = ""): static` Sets body.

### Rendering

[](#rendering)

`emitHeaders()` Sends headers. `emitBody(int $bufferLength = 0)` Sends Content. `emit(int $bufferLength = 0)` Sends headers &amp; body.

Session
-------

[](#session)

`Bredala\Http\Session` helps to work with HTTP response.

- `__construct(\SessionHandlerInterface $handler = NULL)` The constructors can use an optionnal session handler.
- `start(): static` Start the session.
- `close(): static` Writes and closes current session.
- `destroy(): static` Destroys session.
- `reset(): static` Removes all sessions vars.
- `all()` Returns all session data.
- `has(string $name): bool` Returns all session data.
- `get(string $name, $default = null): mixed` Returns session data by name.
- `set(string $name, mixed $value): static` Sets session data by name.

### Flash data

[](#flash-data)

Session data that will only be available for the next request, and is then automatically cleared.

- `setFlash(string $name, $value): static`
- `markFlash(string $name): static`
- `unmarkFlash(string $name): static`

### Temp data

[](#temp-data)

Session data with a specific expiration time. After the value expires, or the session expires or is deleted, the value is automatically removed.

- `setTemp($name, $value, $time = 300)`
- `markTemp(string $name, int $time = 300)`
- `unmarkTemp(string $name)`

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~138 days

Recently: every ~170 days

Total

9

Last Release

632d ago

Major Versions

1.0.2 → 2.0.02022-09-30

2.0.2 → 3.0.02024-08-14

PHP version history (2 changes)1.0.0PHP &gt;=7.4.0

2.0.0PHP &gt;=8.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b51cb3992d341f8eebde2895a555ccf3d0a5f1d767dbe55d687d1cc312dd27f8?d=identicon)[sugatasei](/maintainers/sugatasei)

---

Top Contributors

[![sugatasei](https://avatars.githubusercontent.com/u/6987162?v=4)](https://github.com/sugatasei "sugatasei (5 commits)")

### Embed Badge

![Health badge](/badges/sugatasei-bredala-http/health.svg)

```
[![Health](https://phpackages.com/badges/sugatasei-bredala-http/health.svg)](https://phpackages.com/packages/sugatasei-bredala-http)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
