Dorm-introducing-multi-compiler-package-π-for-php
- 4 minsDorm is a multi compiler package designed to handle compilation and running of non-php code in your project, now the package support compilation and running of c, c++, python2, python3 and java.
Installing compilers and setting things up
Compilers
C ======> GCC compiler
C++ ======> G++ compiler
Java ======> JDK
Python ======> Python2.7 or Python 3.4 (configure it with python2 or python3 according to your needs).
- MinGw contains g++/gcc compilers
- Java SE Development Kit
- Python you can download any version python2.7 or python3.4.
default paths are :-
and configure itβs paths in the vendor/aa-ahmed-aa/dorm/src/Config.php
for every compiler the default for
Install Dorm
install the package using composer composer require aa-ahmed-aa/dorm
Letβs Compiler and run some code
- This code will compile and run C++ code
- This code will compile and run Java code
- This will compile and run python code
Adding you own Compiler
After installing your own compiler you need to go to vendor/aa-ahmed-aa/dorm/src/Config.php
and add your compiler to the $compilers
array.
path => is the path of your compiler or (alias_name in sys env).
file_extension => the extensions of files this compiler uses.
compile_func => compilation function in the vendor/aa-ahmed-aa/dorm/src/Core.php
.
run_func => run function in the vendor/aa-ahmed-aa/dorm/src/Core.php
.
Then you need to go to you vendor/aa-ahmed-aa/dorm/src/Core.php
and implement your compilation and running for this type of compilers after than you only need to use compile and run for any type of compilers.
Useful Function
- setCompiler
- getCompiler
- setCompilationPath
- getCompilationPath
- createFolderIfNotExisted
- cleanCompilationFolder
Support
If you find any problem with this package feel free to open an issue or
contact me at ahmedkhaled36@hotmail.com
Github π₯ : https://github.com/aa-ahmed-aa/Dorm