/OpenMole-PHP-Wrapper

[UNOFFICIAL] PHP wrapper to communicate easily with the OpenMole REST API

Primary LanguagePHPGNU Lesser General Public License v2.1LGPL-2.1

Contributors Forks Stargazers Issues LGPL 2.1 License


Logo

OpenMole PHP Wrapper

PHP wrapper to communicate easily with the OpenMole REST API
Explore the docs »

Report Bug · Request Feature

Table of Contents

About The Project

This library has been made to more easily integrate the communication between your PHP application (I'm using it with the Lumen µFramework) and an OpenMole REST API !

So this library will wrap all the exposed URL, send a curl request and return the result in an easy to use format for your PHP application.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list and check version of things you need to have to use the library.

  • php
$ php -v
PHP 7.4.3 (cli) (built: Feb 18 2020 15:35:13) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
  • curl
$ curl -V
curl 7.69.0 (x86_64-pc-linux-gnu) libcurl/7.69.0 OpenSSL/1.1.1d zlib/1.2.11 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh2/1.9.0 nghttp2/1.39.2
Release-Date: 2020-03-04
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets
  • composer
$ composer -V
Composer version 1.9.3 2020-02-04 12:58:49

Installation from composer (the easy way)

  1. Move to the root folder of your application
$ cd /path/to/your/app
  1. Make the library required
$ composer require roiarthurb/openmole
  1. Install the required libraries
$ composer install

Installation from git

  1. Clone the OpenMole-PHP-Wrapper
git clone https://github.com/RoiArthurB/OpenMole-PHP-Wrapper.git
  1. Link/Use the lib in your application

Usage

Create a OpenMole Wrapper instance

$myWrapper = new \RoiArthurB\OpenMole\OpenMole( $url = "api.myopenmole.org", $port = 8080, $https = false);

Get full list of jobs running on your OpenMole instance

$result = $myWrapper->getJobs();
var_dump($result); // array(2) { [0]=> object(stdClass)#34 (1) { ["id"]=> string(36) "1b303e8a-b739-46bb-8b9d-323c588e74ff" } [1]=> object(stdClass)#35 (1) { ["id"]=> string(36) "9a1d21e0-c9ed-42e8-b0f3-ba6de6abda53" } } 

Get a single job state

$result = $myWrapper->getJobState("1b303e8a-b739-46bb-8b9d-323c588e74ff");
var_dump($result); // object(stdClass)#34 (1) { ["state"]=> string(8) "finished" } 

For more examples, please refer to the Documentation

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the LGPL 2.1 License. See LICENSE for more information.

Authors

Project Link: https://github.com/RoiArthurB/OpenMole-PHP-Wrapper OpenMole Project Link: https://openmole.org/index.html