The PHP framework interoperability, why is important in 2022 ?

Hello everybody !

Let me show you how we can build a game with PHP here a small train game ( user interopt via web interface, system can be control via human small interface ), with 2 sytstem’s : php-symfony and php-crx-framework.

When you write a lib, you can use it in different way, like direct call, virtualisation call what ever the sense,
interoperability is the most important for a framework.

Few years, i’ve started my own framework and i discover the important
of that. Here is a short code for interoperability with a framework.

I start by install PHP composer packages manager on my LINUX by :

$> php -r « copy(‘’, ‘composer-setup.php’); »
$> php composer-setup.php –install-dir=/usr/local/bin –filename=composer
$> chmod +x /usr/local/bin/composer
$> composer -v
$> composer self-upgrade

In this case, composer is install globally on the system LINUX.
For DEBIAN OS, i simply do that :

$> aptitude search composer
$> composer -v

Witch install :

composer jsonlint{a} php-composer-ca-bundle{a} php-composer-semver{a} php-composer-spdx-licenses{a} php-composer-xdebug-handler{a} php-json-schema{a}
php-psr-container{a} php-psr-log{a} php-react-promise{a} php-symfony-console{a} php-symfony-filesystem{a} php-symfony-finder{a} php-symfony-polyfill-php80{a}
php-symfony-process{a} php-symfony-service-contracts{a}

Get: 1 http://// bullseye/main amd64 php-composer-ca-bundle all 1.2.9-1 [11.0 kB]
Get: 2 bullseye/main amd64 php-composer-semver all 3.2.4-2 [20.4 kB]
Get: 3 bullseye/main amd64 php-composer-spdx-licenses all 1.5.5-2 [13.3 kB]
Get: 4 bullseye/main amd64 php-psr-log all 1.1.3-2 [9232 B]
Get: 5 bullseye/main amd64 php-composer-xdebug-handler all 1.4.5-1 [16.9 kB]
Get: 6 bullseye/main amd64 php-json-schema all 5.2.10-2 [37.8 kB]
Get: 7 bullseye/main amd64 jsonlint all 1.8.3-2 [13.5 kB]
Get: 8 bullseye/main amd64 php-symfony-polyfill-php80 all 1.22.1-1 [9976 B]
Get: 9 bullseye/main amd64 php-psr-container all 1.0.0-2 [3436 B]
Get: 10 bullseye/main amd64 php-symfony-service-contracts all 1.1.10-2 [8052 B]
Get: 11 bullseye/main amd64 php-symfony-console all 4.4.19+dfsg-2 [82.7 kB]
Get: 12 bullseye/main amd64 php-symfony-filesystem all 4.4.19+dfsg-2 [26.1 kB]
Get: 13 bullseye/main amd64 php-symfony-finder all 4.4.19+dfsg-2 [31.4 kB]
Get: 14 bullseye/main amd64 php-symfony-process all 4.4.19+dfsg-2 [36.3 kB]
Get: 15 bullseye/main amd64 php-react-promise all 2.7.0-2 [18.6 kB]
Get: 16 bullseye/main amd64 composer all 2.0.9-2 [407 kB]

Now here i install composer is specific way for my train « game » call for example « smalltraingame »,
witch can be stored on COMPOSER app store or on another part of the Internet network :

$> php -r « copy(‘’, ‘composer-setup.php’); »
$> cd /home/hosting/www_root/ && mkdir -p bin
$> php composer-setup.php –install-dir=bin –filename=composer
$> chmod +x bin/composer
$> composer self-upgrade
$> cd /home/hosting/www_root/
$> mkdir /home/hosting/www_root/
$> composer require frvmcontrolapp/Box2Interuptors
$> composer require frvmcontrolapp/GameSystemControlFr

$> composer require frvmcontrolapp/VRControlerFr
$> composer require frvmcontrolapp/RandomSystem

Of course, composer is in my PATH, here this few command update my : composer.json
Here is my gaming engine example of my header  :

namespace crxcms;
use \crx\crxOrchestratorV0;
use \crx\crxDataSource;
use \crx\TrainGame;
use \crx\TrainController;
use \crx\VRControl;
$p = _APPLI_MAIN_MODULES_PATH_.’myModule/php-ml-master/src’;
$ia = new crxLoaderForLib($p,’frvmcontrolapp’);
use frvmcontrolapp/GameSystemControlFr;
use frvmcontrolapp/VRControlerFr;
use frvmcontrolapp/RandomSystem;
use frvmcontrolapp/BoxWith3Interrupteurs

Now like in CPP, i can declare my engine :

And now in my code i can do :
class VRControler{
function __construct(){
function run(){
$orchestrator = new \crx\crxOrchestratorV0();
if($orchestrator->status()==5){ return array(‘ag1′,’step1’);}
if($orchestrator->status()){ return array(‘ag2′,’step2’);}
if($orchestrator->status()){ return array(‘ag3′,’step1’);}

class TrainGame{
function __construct(){}
function __runInstance(){

$dbi = \crx\crxDataSource::getDs(‘mysql2’);
$user1 = new \crx\crxUser(‘A’,’20’);
$user2 = new \crx\crxUser(‘B’,’20’);
$randomSystem = new RandomSystem();
$my_object = new Train(‘red’,’8′,’tgv’);
$control = new BoxWith3Interrupteurs();
$vr_system = new \crx\VRControl($user1,$user2,$randomSystem,$control);
$crxGame = new \crx\GameStd($my_object,$vr_system,$users);




Here :
=> TrainGame is one of my PHP class.
=> TrainController is a simple SERIAL PORT reader for example ( with custom protocol based on 2 interuptors button system ).
=> crxOrchestrator system engine use : TCP-IP/SEMAPHORES control system loop.

So finnaly we got this gaming system :

PHP framework A => Call composer librairies (framework B) => Call Python ( machine learning system )

A bientôt !

Sources :