Skip to content

Commit

Permalink
Merge pull request #1 from niio972/master
Browse files Browse the repository at this point in the history
First stable version of opencpu php client. Make basics sync and async server side calls to an opencpu server.
  • Loading branch information
niio972 authored Mar 9, 2018
2 parents f504abd + 0632c2a commit 422a286
Show file tree
Hide file tree
Showing 13 changed files with 2,795 additions and 1 deletion.
59 changes: 58 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,58 @@
# opencpu-client-php
openCPU-client-php
=============

openCPU-client-php is a PHP library that works as a client for the **OpenCPU** Server (https://www.opencpu.org/) and it was built with flexibility and maintainability in mind.


Setup
-----

The recommended way to install openCPU-client-php is through [`Composer`](http://getcomposer.org). Just create a ``composer.json`` file and run the ``php composer.phar install`` command to install it:
```json
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/openSILEX/opencpu-client-php"
}
],
"require": {
"openSILEX/opencpu-client-php": "dev-master"
}
}
```

Usage
-----

Configure examples :

After installing openCPU-client-php (through ``"Composer"``), put the examples directory in a web server accessible path.
Set the right vendor path in ``examples/config/configLibrairy.php``

After you will be able to use example, try this :

```php
// Require librairy
require_once '../vendor/autoload.php';

// Require classes
use openSILEX\opencpuClientPHP\OpenCPUServer;
use openSILEX\opencpuClientPHP\classes\OCPUSession;

// connexion to the opencpu server
$ocall = new OpenCPUServer("https://cloud.opencpu.org/ocpu/");
// connection status
print_r("Server status : " . $ocall->status(true));

// array parameters
$parameters1 = array("x" => "500000");

// call R function
$sessionInstance1 = $ocall->makeRCall("base", "identity", $parameters1);
print_r("Source Session $sessionInstance1->sessionId: " . $sessionInstance1->getSource());
print_r("Session $sessionInstance1->sessionId: " . $sessionInstance1->getObjects());



```
37 changes: 37 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "openSILEX/opencpu-client-php",
"description": "A php client for openCPU Server",
"type": "library",
"license": "AGPL-3.0",
"keywords": [
"R",
"opencpu",
"php",
"javascript"
],
"authors": [
{
"name": "Arnaud CHARLEROY",
"email": "arnaud.charleroy@inra.fr",
"role": "Developer"
}
],
"require": {
"php": "^5.5 || ^7.0",
"guzzlehttp/guzzle": "~6.0"
},
"require-dev": {
"phpunit/phpunit": "^6.5"
},
"autoload": {
"psr-4": {
"openSILEX\\openCPUClientPHP\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"openSILEX\\openCPU-client-php\\": "tests/"
}
},
"minimum-stability": "stable"
}
Loading

0 comments on commit 422a286

Please sign in to comment.