PHPackages                             simplon/border - 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. simplon/border

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

simplon/border
==============

Request and Response handler incl. JSON-RPC

0.5.4(12y ago)14961MITPHPPHP &gt;=5.4

Since Mar 7Pushed 12y agoCompare

[ Source](https://github.com/fightbulc/simplon_border)[ Packagist](https://packagist.org/packages/simplon/border)[ Docs](https://github.com/fightbulc/simplon_border)[ RSS](/packages/simplon-border/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (6)Used By (1)

```
     _                 _               _                   _
 ___(_)_ __ ___  _ __ | | ___  _ __   | |__   ___  _ __ __| | ___ _ __
/ __| | '_ ` _ \| '_ \| |/ _ \| '_ \  | '_ \ / _ \| '__/ _` |/ _ \ '__|
\__ \ | | | | | | |_) | | (_) | | | | | |_) | (_) | | | (_| |  __/ |
|___/_|_| |_| |_| .__/|_|\___/|_| |_| |_.__/ \___/|_|  \__,_|\___|_|
                |_|
```

Simplon/Border
==============

[](#simplonborder)

A small library to handle http requests and responses including JSON-RPC.

Version
-------

[](#version)

0.5.2

How to install
--------------

[](#how-to-install)

Since this library is build with [PHP 5.4 syntax](http://php.net/manual/en/migration54.new-features.php) you are required to have it installed. Simplon/Border can bei installed by either downloading it from github or via [Composer](http://getcomposer.org). I encourage you to do the latter. Here is a snippet from a possible composer.json file:

```
{
  "require": {
    "php": ">=5.4",
    "simplon/border": "0.5.2"
  }
}
```

Request object
--------------

[](#request-object)

The request class is basically an interface wrapper for PHP's [$\_SERVER](http://php.net/manual/en/reserved.variables.server.php) variable. I also added some methods which help to identify/handle JSON-RPC requests.

### Examples

[](#examples)

Just a couple of calls to show you how we roll. Have a look at the class to see all methods:

```
// print request method
echo Request::getInstance()->getMethod();

// print request uri
echo Request::getInstance()->getUri();

// print query string
echo Request::getInstance()->getQueryString();

// print remote ip
echo Request::getInstance()->getRemoteIp();
```

How to handle JSON-RPC requests?

```
// is that a json-rpc request?
if(Request::getInstance()->isJsonRpc())
{
  // print request id
  echo Request::getInstance()->getJsonRpcId();

  // print method
  echo Request::getInstance()->getJsonRpcMethod();

  // print params | array
  var_dump(Request::getInstance()->getJsonRpcParams());
}
```

Response object
---------------

[](#response-object)

In the demand of talking [HTTP](http://www.w3.org/Protocols/rfc2616/rfc2616-sec6.html)? The response class does exactly that. You can use it to respond to a http request by sending:

- status codes (e.g. 200, 400, 500 ...)
- initiating a file download
- initiating a streaming process (chunking)
- return to referer
- json-rpc response
- json response
- html response
- text
- redirect to another address

### Examples

[](#examples-1)

Here are a couple of examples. Have a look at the class to see all:

```
// initiating file download
(new Response())->sendFile('/your/file/path/file.pdf', 'application/pdf');

// talk json-rpc
(new Response())->sendJsonRpc('result', ['name' => 'hansi'], 1);

// talk json
(new Response())->sendJson(['name' => 'hansi']);

// send status code
(new Response())->sendStatusCode(500);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

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 ~95 days

Total

5

Last Release

4438d ago

PHP version history (2 changes)0.5.0PHP &gt;=5.3.3

0.5.2PHP &gt;=5.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/451061?v=4)[Tino Ehrich](/maintainers/fightbulc)[@fightbulc](https://github.com/fightbulc)

---

Tags

responserequestjson-rpc

### Embed Badge

![Health badge](/badges/simplon-border/health.svg)

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.0B3.2k](/packages/guzzlehttp-psr7)[psr/http-message

Common interface for HTTP messages

7.1k1.0B5.5k](/packages/psr-http-message)[psr/http-factory

PSR-17: Common interfaces for PSR-7 HTTP message factories

1.9k692.9M1.9k](/packages/psr-http-factory)[fig/http-message-util

Utility classes and constants for use with PSR-7 (psr/http-message)

39489.0M274](/packages/fig-http-message-util)[nette/http

🌐 Nette Http: abstraction for HTTP request, response and session. Provides careful data sanitization and utility for URL and cookies manipulation.

48619.2M541](/packages/nette-http)[psr/http-server-handler

Common interface for HTTP server-side request handler

175101.3M921](/packages/psr-http-server-handler)

PHPackages © 2026

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