PHPackages                             alex-kalanis/remote-request - 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. alex-kalanis/remote-request

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

alex-kalanis/remote-request
===========================

PHP libraries for make queries onto remote servers

v6.3.1(10mo ago)01261BSD-3-ClausePHPPHP &gt;=7.4.0CI failing

Since Jun 20Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/alex-kalanis/remote-request)[ Packagist](https://packagist.org/packages/alex-kalanis/remote-request)[ RSS](/packages/alex-kalanis-remote-request/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (9)Dependencies (5)Versions (11)Used By (1)

Remote Request
==============

[](#remote-request)

[![Build Status](https://github.com/alex-kalanis/remote-request/actions/workflows/code_checks.yml/badge.svg)](https://github.com/alex-kalanis/remote-request/actions/workflows/code_checks.yml/badge.svg)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8a1f703177695e5b1d272d7f1110126d75834372e66b21bc993965dab56deb70/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c65782d6b616c616e69732f72656d6f74652d726571756573742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/alex-kalanis/remote-request/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/187efb2eec9885aca982abbf9b1a5c6de6ff3be14b598e8a58904c14a4742736/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6b616c616e69732f72656d6f74652d726571756573742f762f737461626c652e7376673f763d31)](https://packagist.org/packages/alex-kalanis/remote-request)[![Minimum PHP Version](https://camo.githubusercontent.com/0e9ac047546796cfdbe1423d1f4d91c8f37d2fbb11614a7900bb7686aaa5401f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e342d3838393242462e737667)](https://php.net/)[![Downloads](https://camo.githubusercontent.com/1a39a8f93eed7d2e67bee1b2fff6a60854c6dd9bdbb60f4f31106036938ed0f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c65782d6b616c616e69732f72656d6f74652d726571756573742e7376673f7631)](https://packagist.org/packages/alex-kalanis/remote-request)[![License](https://camo.githubusercontent.com/a244c20e846ed3628db97e190a14e07ea9b993faa16469e8510121cd6138b3dd/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6b616c616e69732f72656d6f74652d726571756573742f6c6963656e73652e7376673f763d31)](https://packagist.org/packages/alex-kalanis/remote-request)[![Code Coverage](https://camo.githubusercontent.com/77dd4671ee918be4828813c99057f8dee33004ecfdff848a3b9fcf73dd948852/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f616c65782d6b616c616e69732f72656d6f74652d726571756573742f6261646765732f636f7665726167652e706e673f623d6d617374657226763d31)](https://scrutinizer-ci.com/g/alex-kalanis/remote-request/?branch=master)

Requests for local and remote servers in object way. Contains libraries for querying remote machines - more universal way than Curl and more verbose than file\_get\_contents().

The basic philosophy of this package is keep it simple and work with bulks of data, although there are streams underneath and stream variables has been used for passing the options. And that's the main difference - due streams underneath you can work with really large bulk of data. You are not too limited by size of memory.

Installation
------------

[](#installation)

```
composer.phar require alex-kalanis/remote-request
```

(Refer to [Composer Documentation](https://github.com/composer/composer/blob/master/doc/00-intro.md#introduction) if you are not familiar with composer)

Major changes
-------------

[](#major-changes)

- Version 1 was initial
- Version 2 separated network layers 2 and 3 - transportation and content protocols
- Version 3 is packaged for Composer
- Version 4 has internal structure change after adding "new" socket and protocol.
- Version 5 changed paths and namespaces, use streams and translations
- Version 6 changed naming from schema to params and allow to use one connection for passing data there and back

Usages
------

[](#usages)

### RemoteRequest FSocket/Stream

[](#remoterequest-fsocketstream)

Basic data sending through network. In this case using method FSocket. No basic dependencies, secured connection wants compilation php with ssl. Beware - in that case it's necessary to have as trusted on machine own unsigned keys! On the other side - it's possible to disable this check using Helper and setting context params (not advised).

Basic usage (http query):

```
    $libParams = new RemoteRequest\Connection\Params\Ssl();
    $libParams->setTarget('10.0.0.1', 2048);

    $libQuery = new RemoteRequest\Protocols\Http\Query(); # http internals
    $libQuery
        ->setMethod('post')
        ->setRequestSettings($libParams)
        ->setPath('/api/hook/')
        ->addValues([
            'service_id' => $serviceId,
            'hook_data' => $data,
        ])
    ;

    $libProcessor = new RemoteRequest\Connection\Processor(); # tcp/ip http/ssl
    $libProcessor->setConnectionParams($libParams);
    $libProcessor->setData($libQuery);

    $libHttpAnswer = new RemoteRequest\Protocols\Http\Answer();
    $response = $libHttpAnswer->setResponse($libProcessor->getResponse());
    return $response->getContent();
```

```
    return RemoteRequest\Helper::getRemoteContent(
        'https://10.0.0.1:2048/api/hook/',
        [
            'service_id' => $serviceId,
            'hook_data' => $data,
        ], [
            'method' => 'post',
            'multipart' => true,
        ]
    );
```

Variant for UDP

```
    $libParams = new RemoteRequest\Connection\Params\Udp(); # query params on layer 3
    $libParams->setTarget('udp-listener.' . DOMAIN, 514);

    $message = new RemoteRequest\Protocols\Dummy\Query();
    $message->maxLength = 0; // expects no response
    $message->body = 'Post message to them!';

    $libProtocol = new RemoteRequest\Connection\Processor();
    $libProtocol->setProtocolSchema($libParams)->setData($message);
    $libProtocol->getResponse(); // just execute
```

```
    RemoteRequest\Helper::getRemoteContent(
        'udp://udp-listener.' . DOMAIN . ':514',
        'Post message to them!'
    );
```

Thanks to the inheritance it's possible to make a tons of interesting changes. For change targeting it's possible to set it directly or make a child and set connection params there. Next - there is possible by only exchange of result classes process XML or JSON.

Operator (both FSocket and Stream) send agent "php-agent/1.3", but it is also possible to change it.

Connection Params
-----------------

[](#connection-params)

Contains basic information about method of transferring on network layer level 2 and destined target of query - usually address and port. Also have other things necessary to connect another machine like schema and timeout.

### Params UDP

[](#params-udp)

Send it through UDP protocol.

No thanks to the troubles with testing it also contains 2 files for checking connection on local machine, slurped somewhere on StackOverflow. For using this you need 2 terminal windows - one for server and another for client. You write messages on client. If messages has not been shown on both windows there is dead connection inside your ma machine and it will have problems also with connecting external targets - and still it might be set right.

### Params TCP / HTTP / SSL

[](#params-tcp--http--ssl)

Basically variants which send data through tcp protocol. Tcp and Http are in unsecured, SSL is secured (depends on php if its compiled with ssl support or defined own stream which pass this obstacle). Http and SSL also adds Http headers.

### Params PHP internals - File, Php

[](#params-php-internals---file-php)

Inside the params there is 2 for accessing internal sources. They are meant for testing purposes. It is possible to test access to data and they did not need to be saved on external machine.

Pointers
--------

[](#pointers)

Nothing so fancy, but just only sources of pointers from stream processors. Both on remote machine and/or local storage.

### Socket

[](#socket)

The most specific one. Usable mainly for connecting with UDP schema. It does not need to wait after receive data packet which happens with others.

### FSocket, PFsocket

[](#fsocket-pfsocket)

The most stupid ones and most known ones. You cannot convice them with context about your truth like "That connection IS correctly secured".

### Stream

[](#stream)

Stream inside PHP. Can use context params. But for sanity it did not get anything from higher manipulation functions; even if that works for it.

### Shared internal

[](#shared-internal)

Local for testing purposes. It should got some wrapper from internals. Then it's possible to save data there which got only pointer from PHP.

Protocols
---------

[](#protocols)

There is defined a few basic protocols and their helpers which makes life with them easier. On the top there is examples of processing HTTP and UDP. Also it contains a base for querying REST APIs.

### Restful

[](#restful)

Extended, edited HTTP, which in message body has a JSON data package instead of normal bulk of HTTP data. It can also pass files - uses base64 for transfer. But it cannot compile it back due unknown definition of data which came from the server.

### FSP

[](#fsp)

File Sharing Protocol a.k.a. FTP-over-UDP. Old, hackish, slow, but interesting protocol, which shows that there is no problem with making anything readable what is set into the files in layers. You could find more about it online. Here is simple wrapper for PHP which allows you use it transparently.

Tests
-----

[](#tests)

Uses PhpUnit tests. Download Phpunit.phar, save it to the root, make it executable and run. There is excluded directory - Wrappers. They're here to access remote sources and simplify your life, so it isn't good idea to run tests on them. Also Helper isn't covered for same reason.

Not PSR-7
---------

[](#not-psr-7)

This library is not compliant with PSR-7 and that is for a few reasons. At first the PSR-7 has been made with HTTP in mind. Then it got streams and totally discarded the filling of the usually sent body. Some things are specific for HTTP and in other protocols are unwelcome. I now write about schema:host:port and form inputs. Then you have "StreamInterface" in which you got the message body. Not separated by values, not set boundaries to header, just raw data. It also does not behave like a normal stream, so using "stream\_copy\_to\_stream" does not work.

If you really want to know more, try to implement FSP or SMB connectors via PSR-7. You will get a lot of headache. Or HTTP2/3, where the content is binary-encoded and runs over udp schema (in case of 3). You WILL have a lots of problems implement that. Not with Remote Request, where the responsibilities stays separated.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance53

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

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

Recently: every ~192 days

Total

9

Last Release

327d ago

Major Versions

v4.0.0 → v5.0.02021-09-18

v5.1.0 → v6.0.02022-09-08

PHP version history (2 changes)v4.0.0PHP &gt;=7.2.0

v6.3.0PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/499b0a541b787cdb31412f578c7b94c9790bcbee7de12c65b6101c6ce45ef6f0?d=identicon)[alex-kalanis](/maintainers/alex-kalanis)

---

Top Contributors

[![alex-kalanis](https://avatars.githubusercontent.com/u/59184183?v=4)](https://github.com/alex-kalanis "alex-kalanis (57 commits)")

---

Tags

httprequestrestcurlservertcpSocketudprestapifspfsocket

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/alex-kalanis-remote-request/health.svg)

```
[![Health](https://phpackages.com/badges/alex-kalanis-remote-request/health.svg)](https://phpackages.com/packages/alex-kalanis-remote-request)
```

###  Alternatives

[hhxsv5/laravel-s

🚀 LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.

3.9k676.0k10](/packages/hhxsv5-laravel-s)[nategood/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

1.8k17.2M267](/packages/nategood-httpful)

PHPackages © 2026

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