PHP code example of belgattitude / pjbserver-tools

1. Go to this page and download the library: Download belgattitude/pjbserver-tools library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

belgattitude / pjbserver-tools example snippets




use PjbServer\Tools\StandaloneServer;
use PjbServer\Tools\StandaloneServer\Config;

$tcp_port = 8089;

$config = new Config([
    // Port on which php java bridge server listen (t testing, but to prevent loosing those files
     * set a safe directory (not /tmp as it might be cleared by the OS)
     */
    //'log_file'   => "/my/path/var/pjbserver-port${tcp_port}.log",
    //'pid_file'   => "/my/path/var/pjbserver-port${tcp_port}.pid",


    // Optional but often more than useful
    'classpaths'  => [
          '/my/path/*.jar',
          '/another/path/mylib.jar'
    ],

    // Standalone server tuning
    // Number of threads for standalone server is 50, increase if needed
    //'threads'    => 50,

    // Java binary
    // change location if you like, for example
    // /usr/lib/jvm/java-8-oracle/bin/java
    'java_bin' => 'java',

    /**
     * Location of the JavaBridge.jar,
     * Default is to use the default (

// any PSR-3 compatible logger
$logger = new \Psr\Log\NullLogger();
$server = new StandaloneServer($config, $logger);




return [
    'port'       => 8089,
    'classpaths' => [
        '/my/path/autoload/mysql-connector.jar',
        '/my/autoload_path/*.jar'
    ],
];
console
$ ./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