Download the PHP package belgattitude/pjbserver-tools without Composer

On this page you can find all versions of the php package belgattitude/pjbserver-tools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pjbserver-tools

pjbserver-tools

PHP Version PHP Version PHP Version Build Status codecov Scrutinizer Code Quality Latest Stable Version Total Downloads License

The pjbserver-tools package currently provides an easy installable php java bridge standalone server. See the soluble/japha and 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

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

Requirements

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 project.

    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.

  2. Option 2: Console, clone the repo.

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

    Clone the repository and use run composer update.

    Test a command line

Usage

Command line

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

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.

If you use the ./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 :

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

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:

You can also inject any PSR-3 compatible logger to the StandaloneServer.

Configuration

The dist config file ./config/pjbserver.config.php.dist contains the default parameters used in console mode.

Parameters

Key Type Comment
port int TCP port on which standalone server listen
classpaths array Java additional classpaths
threads int Server max number of threads
java_bin string Java binary executable (with or without path)
server_jar string Path to the JavaBridge.jar file
log_file string Path to the standalone server log file
pid_file string Path to the standalone pid file

Some considerations:

Classpath configuration

Whenever you need to add some java libraries, simply edit the configuration file and look for the classpaths option and add the required jar files.

As an example:

Don't forget to restart the standalone server to reflect the changes.

Using wildcard /my/path/*.jar is possible but should be used with care. All matching files will be appended to classpath by passing arguments in a shell exec. Limits exists...

Debugging

Some useful commands to watch, debug and eventually kill java standalone server process

Getting the status (running/not running)

Reveal the issued command

For example, the issued command the default config can be

Process management

If for any reason the server cannot be stopped through the console, you can lookup the process through the command line.

You can kill the process:

FAQ

How to start automatically at boot

Check for "supervisord" on google, you'll find some recipes but the preferred method is to deploy on Tomcat, see:

For alternatives to pjbserver-tools standalone.

Coding standards


All versions of pjbserver-tools with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
psr/log Version ^1.0
symfony/console Version ^4.0 || ^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package belgattitude/pjbserver-tools contains the following files

Loading the files please wait ....