PHPackages                             belgattitude/pjbserver-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. belgattitude/pjbserver-tools

ActiveLibrary[CLI &amp; Console](/categories/cli)

belgattitude/pjbserver-tools
============================

PHP Java bridge server tools

4.1.0(5y ago)108.0k42MITPHPPHP ^7.4 || ^8.0

Since Nov 22Pushed 5y ago2 watchersCompare

[ Source](https://github.com/belgattitude/pjbserver-tools)[ Packagist](https://packagist.org/packages/belgattitude/pjbserver-tools)[ Docs](https://github.com/belgattitude/pjbserver-tools)[ RSS](/packages/belgattitude-pjbserver-tools/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (11)Versions (20)Used By (2)

pjbserver-tools
===============

[](#pjbserver-tools)

[![PHP Version](https://camo.githubusercontent.com/0d4e5882fa1caaa7d5771ea72be1661bc43b0055a87a3c586d694db2eeb4b4d4/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d352e352b2d6666363962342e737667)](https://packagist.org/packages/belgattitude/pjbserver-tools)[![PHP Version](https://camo.githubusercontent.com/375e8de41f75571c97dd554f5c9f27ae12cd39c71eb6a02478a79f5962e5801e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e312b2d6666363962342e737667)](https://packagist.org/packages/belgattitude/pjbserver-tools)[![PHP Version](https://camo.githubusercontent.com/877cc78d90896f3adebee6f22d7557918d647a983424573ec3cd4b954f1c5015/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e302b2d6666363962342e737667)](https://packagist.org/packages/belgattitude/pjbserver-tools)[![Build Status](https://camo.githubusercontent.com/fa560e381b562dca2e781fe6b3cf6f6e0b3d87ab4586ec0ca870330d765676fa/68747470733a2f2f7472617669732d63692e6f72672f62656c6761747469747564652f706a627365727665722d746f6f6c732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/belgattitude/pjbserver-tools)[![codecov](https://camo.githubusercontent.com/3135299c24058a8698448ae4f8b83c41596a27f49e0af986e884215b55f60a47/68747470733a2f2f636f6465636f762e696f2f67682f62656c6761747469747564652f706a627365727665722d746f6f6c732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/belgattitude/pjbserver-tools)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7c8753d5ba4c1659c1a2472a4ed8e1615765150bf499f60d50894810983cf86a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62656c6761747469747564652f706a627365727665722d746f6f6c732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/belgattitude/pjbserver-tools/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/59ffd2eb6730598652a73dc6e135a1b7888f730c06103144cd60e4fec32fdc23/68747470733a2f2f706f7365722e707567782e6f72672f62656c6761747469747564652f706a627365727665722d746f6f6c732f762f737461626c652e737667)](https://packagist.org/packages/belgattitude/pjbserver-tools)[![Total Downloads](https://camo.githubusercontent.com/3afbd809747c3fcfea2a6a71f7acd45e36cad9fa3d1a09bae15b5031c98973e0/68747470733a2f2f706f7365722e707567782e6f72672f62656c6761747469747564652f706a627365727665722d746f6f6c732f646f776e6c6f6164732e737667)](https://packagist.org/packages/belgattitude/pjbserver-tools)[![License](https://camo.githubusercontent.com/480613a57a3d21114a6071823e6d282fdf0c51fc7b04d44752d0c6e9ee2f9672/68747470733a2f2f706f7365722e707567782e6f72672f62656c6761747469747564652f706a627365727665722d746f6f6c732f6c6963656e73652e737667)](https://packagist.org/packages/belgattitude/pjbserver-tools)

The `pjbserver-tools` package currently provides an easy installable php java bridge standalone server. See the [soluble/japha](https://github.com/belgattitude/soluble-japha) and [php-java-bridge](https://github.com/belgattitude/php-java-bridge)projects to get more info about php/java integration.

> **Note** that the `pjbserver-tools` standalone server utility was made for easy composer installation when developing or testing.
>
> **For production, building a customized PHPJavaBridge server is really easy. Check the recommended [php/java/bridge installation notes](http://docs.soluble.io/soluble-japha/install_server/)**

Use cases
---------

[](#use-cases)

The java bridge standalone server can be used as an alternative to a regular bridge installation for php/java integration while keeping things simple for development, unit testing or small projects.

Features
--------

[](#features)

- Easy setup of a PHP Java bridge standalone server (\*nix).
- Console commands to control the server (start/stop/restart/status).
- API library to customize the behaviour.
- Includes compiled [JavaBridge.jar](./resources/pjb713_standalone/JavaBridge.jar) 7.1.3 file.

Requirements
------------

[](#requirements)

- PHP 5.5+, 7.0 or HHVM &gt;= 3.2.
- Linux/Unix *(Mac OSX 10.1+ reported working)*.
- Java 1.7+ (see [install instructions](./doc/install_java.md)).

Installation
------------

[](#installation)

> **WARNING** The phpjavabridge server is not supposed to be run on a public facing server and its use should be limited to interactions on the same host/network with the php client. Do not run it as root neither as it exposes the JVM methods through the network that could be remotely exploited. Do not start it as root neither.

Depending on your needs you can use the pjserver-tools in two ways.

1. Option 1: Composer install

    You can easily add the pjbserver-tools to your existing [composer](http://getcomposer.org/) project.

    ```
    $ composer require belgattitude/pjbserver-tools
    ```

    It can also be added to your development dependencies (replace `require` by `require --dev` in the previous command). Very helpful if you intend to test with Travis...

    Test a command line.

    ```
    ./vendor/bin/pjbserver-tools pjbserver:status ./vendor/belgattitude/pjbserver-tools/config/pjbserver.config.php.dist -vvv
    ```
2. Option 2: Console, clone the repo.

    First create a path on your filesystem that will hold the server install.

    ```
    $ mkdir -p /my/path/pjbserver-tools
    $ cd /my/path/pjbserver-tools
    ```

    Clone the repository and use run [composer](http://getcomposer.org) update.

    ```
    $ git clone https://github.com/belgattitude/pjbserver-tools.git
    $ cd pjbserver-tools
    $ composer update
    ```

    Test a command line

    ```
    ./bin/pjbserver-tools pjbserver:status ./config/pjbserver.config.php.dist -vvv

    ```

Usage
-----

[](#usage)

### Command line

[](#command-line)

Command line depends on your install method (composer or clone/download).

- With composer the location of the binary is `./vendor/bin/pjbserver-tools` and the default config is located in `./vendor/belgattitude/pjbserver-tools/config/pjbserver.config.php.dist`.
- With the clone method, binary is `./bin/pjbserver-tools` and default config is `./config/pjbserver.config.php.dist`.

*For clarity, the documentation of console commands is based on the clone method. Simply replace your path whenever needed.*

You can use the commands `pjbserver:start`, `pjbserver:stop`, `pjbserver:restart`, `pjbserver:status` followed by the `pjbserver.config.php` file to control or query the server status.

```
$ ./bin/pjbserver-tools pjbserver:start -vvv ./config/pjbserver.config.php.dist
$ ./bin/pjbserver-tools pjbserver:stop -vvv ./config/pjbserver.config.php.dist
$ ./bin/pjbserver-tools pjbserver:restart -vvv ./config/pjbserver.config.php.dist
$ ./bin/pjbserver-tools pjbserver:status -vvv ./config/pjbserver.config.php.dist

$ # for listing the java cli command issued :
$ ./bin/pjbserver-tools pjbserver:reveal ./config/pjbserver.config.php.dist
```

If you use the [./config/pjbserver.config.php.dist](./config/pjbserver.config.php.dist) config file, the server will start on port ***8089***.

Feel free to create a local copy of this file and adapt for your usage :

```
$ cp ./config/pjbserver.config.php.dist /my/path/pjbserver.config.php
```

*Note that the -v, -vv, -vvv option in the command line allows to define the verbosity level of the scripts.*

### Controlling via the API

[](#controlling-via-the-api)

Command line is good, but API gives a little more control especially good when setting unit tests and CI.

Here's a little example:

```
