-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from niio972/master
First stable version of opencpu php client. Make basics sync and async server side calls to an opencpu server.
- Loading branch information
Showing
13 changed files
with
2,795 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
|
||
|
||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
Oops, something went wrong.