Download the PHP package kachkaev/php-r without Composer

On this page you can find all versions of the php package kachkaev/php-r. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-r

php-r

PHPR (or php-r) is a library that provides ability to run R scripts from PHP. Composer package: kachkaev/php-r.

Optionally, the library is available as a bundle for Symfony2 users.

The idea is based on invoking a command-line version of R and exchanging messages with this external process. Integration with server-based implementation of R can be easily implemented on demand as the library architecture supports that.

It is possible to both run all R code in one batch and interactively exchange commands with R interpreter.

Usage

Option 1: all R code in one batch

PHP output:

Method is always called in a clean scope of R variables, i.e. the following usage will result an R error:

PHP output:

Option 2: interactive exchange of data

To exchange commands with a single R process interactively, another approach should be used:

PHP output:

The process is synchronous, i.e. if R code sent to implies some complex computations, PHP will wait until they are finished.

Multiple commands can be passed to R inside one ; they can be multi-line too:

It is strictly necessary to keep commands complete. The following example will result a critical error, and R process will be terminated.

Separate access to input / output / errors for each R command

To avoid manual splitting of a mix of R input, output and errors, the result of script execution can be accessed separately:

Passing to splits strings into arrays, where each element corresponds to a single command:

Sensitivity to R errors

If it is necessary to make sure that a sequence of R commands is running with no errors, and calling after each is unreasonable, the process can be made sensible to errors. will be thrown on :

This is the same as:

R-related errors and the exception thrown are not critical; the same instance of R process can be still used after they occur. If last input contains multiple commands, and several of them cause errors, will have the complete list. In any case all commands passed to will be attempted by R interpreter.

Parsing R output

To ease parsing of R output, can be used:

See PHPdoc annotations to classes for more details.

License

MIT. See LICENSE.

Donate


All versions of php-r with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.9
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package kachkaev/php-r contains the following files

Loading the files please wait ....