PHPackages                             sohris/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. sohris/http

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

sohris/http
===========

0.5.1(1y ago)0278MITPHP

Since Mar 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sohris/http)[ Packagist](https://packagist.org/packages/sohris/http)[ RSS](/packages/sohris-http/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (12)Used By (0)

Sohris HTTP
===========

[](#sohris-http)

Summary
-------

[](#summary)

Sohris HTTP is built on ReactPHP, allowing the server to handle requests asynchronously. This non-blocking architecture enables improved performance, as multiple requests can be processed simultaneously without waiting for previous ones to complete.

Creating a Route
----------------

[](#creating-a-route)

To generate a new route in the API, it is necessary to understand the available annotations in PHP, which help manage requests.

### Route Example

[](#route-example)

```
namespace App\Routes\Template;

use Sohris\Http\Response;
use Sohris\Http\Router\RouterControllers\DRMRouter;
use Sohris\Http\Annotations\SessionJWT;
use Sohris\Http\Annotations\Needed;
use Sohris\Http\Annotations\HttpMethod;
use Sohris\Http\Annotations\Route;

class Teste extends DRMRouter
{
    /**
     * @Route("/template/teste/requisicao_1")
     * @SessionJWT(true)
     * @HttpMethod("POST")
     * @Needed({"param_1", "param_2"})
     */
    public static function requisicao_1(\Psr\Http\Message\RequestInterface $request)
    {
        return Response::Json("Hello World!");
    }
}
```

Asynchronous Execution
----------------------

[](#asynchronous-execution)

Sohris HTTP operates **asynchronously**, based on **ReactPHP**, allowing non-blocking request handling.

### Benefits:

[](#benefits)

- **Higher performance** – Processes multiple requests simultaneously.
- **Lower latency** – Faster responses.
- **Efficient resource usage** – Better CPU and memory utilization.

### Asynchronous Return Example with Promise

[](#asynchronous-return-example-with-promise)

```
use React\Promise\Promise;

public static function asyncRoute(\Psr\Http\Message\RequestInterface $request)
{
    return new Promise(function ($resolve) {
        // Simulate an asynchronous operation
        $resolve(Response::Json( "Async Response"));
    });
}
```

With this model, requests do not block execution, ensuring a highly efficient server environment.

### `@Needed`

[](#needed)

Defines the required parameters in the request.

```
@Needed({"param_1", "param_2"})
```

Parameters can be accessed via `REQUEST` in the request object:

```
public static function rota_1(\Psr\Http\Message\RequestInterface $request)
{
    echo $request->REQUEST['param_1'];
    echo $request->REQUEST['param_2'];
}
```

### `@SessionJWT`

[](#sessionjwt)

Indicates that the route requires a valid JWT session. The session is generated by the `/signin/auth/login` route and consists of a JWT token that encapsulates user information.

If the request does not contain a valid token, the server will return **error 403**.

To authenticate, send the token in the header:

```
Authorization: Bearer [TOKEN]

```

### `@HttpMethod`

[](#httpmethod)

Defines the allowed HTTP methods for the route:

```
@HttpMethod("POST")
```

Supported methods:

- **POST**
- **GET**
- **OPTIONS**
- **PUT**
- **DELETE**

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance43

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.6% 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 ~109 days

Recently: every ~74 days

Total

11

Last Release

446d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/521c2c04c593d94272f6b48881974dcaad13a01a82f2b7aaad60a251ab65a747?d=identicon)[rdanieli](/maintainers/rdanieli)

---

Top Contributors

[![rodrigodanieli](https://avatars.githubusercontent.com/u/17441663?v=4)](https://github.com/rodrigodanieli "rodrigodanieli (71 commits)")[![rodrigomdanieli](https://avatars.githubusercontent.com/u/47753921?v=4)](https://github.com/rodrigomdanieli "rodrigomdanieli (1 commits)")

### Embed Badge

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

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

###  Alternatives

[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.3M14](/packages/xeroapi-xero-php-oauth2)[bigcommerce/api

Enables PHP applications to communicate with the Bigcommerce API.

1501.1M8](/packages/bigcommerce-api)[jimtools/jwt-auth

PSR-15 JWT Authentication middleware, A replacement for tuupola/slim-jwt-auth

20142.3k3](/packages/jimtools-jwt-auth)[discord-php/http

Handles HTTP requests to Discord servers

25318.7k8](/packages/discord-php-http)

PHPackages © 2026

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