2017 © Pedro Peláez
 

symfony-bundle php-r-bundle

Symfony2 bundle for integration with php-r library that provides ability to run R scripts from PHP

image

kachkaev/php-r-bundle

Symfony2 bundle for integration with php-r library that provides ability to run R scripts from PHP

  • Thursday, June 15, 2017
  • by kachkaev
  • Repository
  • 2 Watchers
  • 1 Stars
  • 228 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 3 % Grown

The README.md

KachkaevPHPRBundle Build Status

Symfony2/Symfony3 bundle for the php-r library, (*1)

Installation

Composer

Add the following dependency to your project’s composer.json file:, (*2)

    "require": {
        // ...
        "kachkaev/php-r-bundle": "dev-master"
        // ...
    }

Now tell composer to download the bundle by running the command:, (*3)

$ php composer.phar update kachkaev/php-r-bundle

Composer will install the bundle to vendor/kachkaev directory., (*4)

Adding bundle to your application kernel

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Kachkaev\PHPRBundle\KachkaevPHPRBundle(),
        // ...
    );
}

Configuration

Here is the default configuration for the bundle:, (*5)

kachkaev_phpr:
    default_engine: command_line     # default R engine (command_line is the only one currently implemented)  
    engines:
        command_line:
            path_to_r: /usr/bin/R    # path to R interpreter

In most cases custom configuration is not needed, so simply add the following line to your app/config/config.yml:, (*6)

kachkaev_phpr: ~

Usage

$r = $container->get('kachkaev_phpr.core');
$rResult = $r->run('x = 10
x * x');

// --- or ---

$r = $container->get('kachkaev_phpr.core');
$rProcess = $r->createInteractiveProcess();
$rProcess->write('x = 10');
$rProcess->write('x * x');
$rResult = $rProcess->getAllResult();

$rResult contains the following string:, (*7)

> x = 10
> x * x
[1] 100

For detailed feature description of R core and R process see documentation to php-r library., (*8)

An instance of ROutputParser is also registered as a service:, (*9)

$rOutputParser = $container->get('kachkaev_phpr.output_parser');

$rProcess->write('21 + 21');
var_dump($rProcess->getLastWriteOutput());
// string(6) "[1] 42"
var_dump($rOutputParser->singleNumber($rProcess->getLastWriteOutput()));
// int(42)

License

MIT. See LICENSE., (*10)

The Versions

15/06 2017

dev-master

9999999-dev https://github.com/kachkaev/KachkaevPHPRBundle

Symfony2 bundle for integration with php-r library that provides ability to run R scripts from PHP

  Sources   Download

MIT

The Requires

 

symfony2 bundle stats bridge statistical analysis r

15/06 2017

v2.1.0

2.1.0.0 https://github.com/kachkaev/KachkaevPHPRBundle

Symfony2 bundle for integration with php-r library that provides ability to run R scripts from PHP

  Sources   Download

MIT

The Requires

 

symfony2 bundle stats bridge statistical analysis r

15/06 2017

v2.0.0

2.0.0.0 https://github.com/kachkaev/KachkaevPHPRBundle

Symfony2 bundle for integration with php-r library that provides ability to run R scripts from PHP

  Sources   Download

MIT

The Requires

 

symfony2 bundle stats bridge statistical analysis r

15/06 2017

v1.1.0

1.1.0.0 https://github.com/kachkaev/KachkaevPHPRBundle

Symfony2 bundle for integration with php-r library that provides ability to run R scripts from PHP

  Sources   Download

MIT

The Requires

 

symfony2 bundle stats bridge statistical analysis r

23/05 2017

v1.0.0

1.0.0.0 https://github.com/kachkaev/KachkaevPHPRBundle

Symfony2 bundle for integration with php-r library that provides ability to run R scripts from PHP

  Sources   Download

MIT

The Requires

 

symfony2 bundle stats bridge statistical analysis r