Skip to content

MrTimber/CodinGamePHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodinGamePHP

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.

Branches

  • 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

Basic usage

Installation

Run composer install

Edit your code

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.

Combine all sources files into one

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

Sync with Coding Game

Use the Coding Game Chrome plugin to sync with dest/filename.php: Sync with Coding Game

Advanced usage with PhpStorm

Automatise the combination with PhpStorm

In Tools > Filewatcher, set a custom Filewatcher: Set a custom file watcher 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 !

Testing

If you want to implement some tests and run them with PhpStorm, you also set your PHP interpreter in Langages and Frameworks > PHP: Set PHP interpreter 1 Set PHP interpreter 2

PhpStorm tips

You should exclude dest and vendor folders to avoid indexing their content

Note

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.

About

Develop your PHP code for Coding Game challenges using multiple source files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages