Develop your PHP code for Coding Game challenges using multiple source files
This repo has originally been made for Ocean of Code multiplayer game, but it is compatible with any other challenge.
- branch 2.x => uses PHP Parser 5.x: for running on PHP >= 7.4; for parsing PHP 7.0 to PHP 8.4, with limited support for parsing PHP 5.x
- branch 1.x => uses PHP Parser 4.x: for running on PHP >= 7.0; for parsing PHP 5.2 to PHP 8.3
Run composer install
Place your source files in the src folder
The main file is src/app.php which contains the autogenerated PHP code from Coding Game,
a bit modified with 3 empty classes (Map, Player, and Game) required as example.
Configure the dest filename in combine.php
Execute php combine.php
All sources files included from src/app.php will be combined in dest/filename.php
Use the Coding Game Chrome plugin to sync with dest/filename.php:

In Tools > Filewatcher, set a custom Filewatcher:
You must give the full path of your PHP executable, and the full path of the project as working directory.
Now when you modify a source file, the combined file will be regenerated automatically !
If you want to implement some tests and run them with PhpStorm, you also set your PHP interpreter in Langages and Frameworks > PHP:

You should exclude dest and vendor folders to avoid indexing their content
I haven't excluded the .idea folder from repository so you can just adapt my PhpStorm configuration for you own instead of setting it from scratch.