PHPackages                             cturbelin/rserve-php - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cturbelin/rserve-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cturbelin/rserve-php
====================

Rserve client library for PHP

v2.1(2y ago)4434.8k↓33.3%24[6 issues](https://github.com/cturbelin/rserve-php/issues)[3 PRs](https://github.com/cturbelin/rserve-php/pulls)PHPPHP &gt;=7.4

Since Apr 17Pushed 2y ago12 watchersCompare

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

READMEChangelog (1)Dependencies (2)Versions (5)Used By (0)

Rserve-php
==========

[](#rserve-php)

php5 client for Rserve  (a TCP/IP server for R statistical software)

[![Build Status](https://camo.githubusercontent.com/64a0e62abd143f4bd8028117eebeca10acad0cdb13a8f0b815fd23a5187afff8/68747470733a2f2f7472617669732d63692e6f72672f7368616469616b696b69313938362f7273657276652d7068702e7376673f6272616e63683d322e302d696d70726f76656d656e7473)](https://travis-ci.org/shadiakiki1986/rserve-php)

Changes from 1.0 version
------------------------

[](#changes-from-10-version)

- All classes are declared under Sentiweb\\Rserve namespace allowing PSR-4 autoloading
- Parsers are now individualized into classes
- A Parser instance can be directly used as second argument of evalString() to replace default parser (see example)

Tests
-----

[](#tests)

You can run tests using phpunit

Several tests need to have a running Rserve server (not handled by this library). To configure the test to use a server you have to configure the connection using environment vars or by creating a file in tests/config.php and defining constants (a sample file is available in tests/config.php.sample). Expected vars (in env or as constant in tests/config.php)

- `RSERVE_HOST` : hostname or IP of the Rserve server (e.g. 'localhost' or 127.0.0.1 for local server).
- `RSERVE_PORT` : port number, if value is '0' or 'unix', the HOST is expected to be a unix socket path.
- `RSERVE_USER` : username if the Rserve server is expecting authentication, skip or leave empty if not
- `RSERVE_PASS` : password if the Rserve server is expecting authentication, skip or leave empty if not

`RSERVE_HOST` is required to be defined (either env or in config.php) to run the connection aware tests, if not these tests will be skipped.

Credential-free tests

- launch your credential-free Rserve instance
- Can be done with `docker run -d -p 6311:6311 wnagele/rserve`
- if installed with composer: `composer test`
- otherwise, run with `phpunit`

Login tests: This test suite require a credential-protected Rserve instance to be running (not provided by this library) and the credentials (username and password to be configured as described above)

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

[](#installation)

Using without composer : include src/autoload.php in your project

Using with composer:

- run `composer require cturbelin/rserve-php:2.0.x-dev`
- add `require __DIR__.'/../vendor/autoload.php';` to your project

Some usage example are provided in [example](example) directory

Using Login Authorization
-------------------------

[](#using-login-authorization)

Usage is the same as the vanilla usage, except for the constructor

```
   $cnx = new \Sentiweb\Rserve\Connection('myserverhost', 6311, ['username'=>username,'password'=>password])
```

Parsers
-------

[](#parsers)

Results provided by R could be handled using several parsers

- NativeArray Translates R structure into php simple arrays. It is useful to get simple values from R
- Wrapped array Using NativeArray with parameters `array("wrapper"=>true)` in contructor return object with attributes of R objects. The result object can be used as an array and provides methods to access R object attributes
- Debug Translates R response to structure useful for debugging
- REXP Translates R response into REXP classes

Async Mode
----------

[](#async-mode)

Several functions allow to use connection in async mode

- getSocket() to get the socket an set some options
- setAsync() allow to set the async mode
- getResults($parser) : get and parse the results after a call to evalString() in async mode

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 86.8% 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 ~890 days

Total

4

Last Release

1012d ago

Major Versions

1.0.x-dev → 2.0.x-dev2023-08-10

PHP version history (2 changes)v1.0PHP &gt;=5.2.0

2.0.x-devPHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1282776?v=4)[Clément Turbelin](/maintainers/cturbelin)[@cturbelin](https://github.com/cturbelin)

---

Top Contributors

[![cturbelin](https://avatars.githubusercontent.com/u/1282776?v=4)](https://github.com/cturbelin "cturbelin (79 commits)")[![shadiakiki1986](https://avatars.githubusercontent.com/u/8392324?v=4)](https://github.com/shadiakiki1986 "shadiakiki1986 (11 commits)")[![rathivivek](https://avatars.githubusercontent.com/u/9977079?v=4)](https://github.com/rathivivek "rathivivek (1 commits)")

---

Tags

statsrRserve

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/cturbelin-rserve-php/health.svg)

```
[![Health](https://phpackages.com/badges/cturbelin-rserve-php/health.svg)](https://phpackages.com/packages/cturbelin-rserve-php)
```

###  Alternatives

[wnx/laravel-stats

Get insights about your Laravel Project

1.8k1.8M7](/packages/wnx-laravel-stats)[richjenks/stats

Statistics library for non-statistical people

23149.0k1](/packages/richjenks-stats)[timothepearce/laravel-time-series

Laravel Time Series provides an API to create and maintain projected data from you Eloquent models, and represent them as time-series.

955.4k](/packages/timothepearce-laravel-time-series)[magirc/magirc

MagIRC - Let the magirc begin!

381.1k](/packages/magirc-magirc)

PHPackages © 2026

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