Read the English version of this document: English
Read this document in other languages: English, Simplified Chinese .
With the strong rise of Go
and NodeJS
, PHP
's market share has gradually been eroded, but PHP
officially still sticks to the field of Web
programming. Some things become harder to hold on to the more they try to hold on. polarphp
draws on the relevant features of NodeJS
and Go
to re-encapsulate zendVM
, remove some of PHP
old abandoned features and strong Web
attributes, and implement a new set of runtime framework libpdk
to build PHP
language into a truly universal scripting language , empowering PHP
with asynchronous programming, coroutines, threads, built-in unicode
support, standard file IO
and other features, allowing PHP
programmers to not only do web
applications, but also calmly face real server-side applications . polarphp
is not a new language, but a new compiler and runtime for PHP
language in addition to the official one.
PHP
language standards and removing obsolete language features unicode
character standards support Due to limited development resources, the development plan is tentatively set as follows:
PHP
compiler front-endlit
testing framework for transplanting LLVM
projectpolarphp
compiler front-end using the phplit
regression testing frameworkpolarvm
and complete the infrastructure of the virtual machinepolarphp
AST to the instruction set, and do not define the IR layer for the time being.phplit
to test all compiled modules from language structure to instruction setPHP
’s built-in GC
PHP
language standard library libpdk
( cpp
part)polarphp
in the minimum number of steps.PHP
standard library (implemented using PHP
code with libpdk
underlying support) polarphp
project library git clone https://github.com/polarphp/polarphp.git
cd polarphp
git submodule init
git submodule update
git checkout v0.0.1-alpha
./devtools/scripts/build_polarphp.sh
At this time, the script starts to compile related images, which takes a long time. Please wait patiently. Wait for compilation to complete and you run:
docker images
At this time, please confirm that there is the following image in the output:
If there is no problem, we start to test whether polarphp
is running normally in the mirror.
docker run --rm -it polarphp_debug
After entering the container, enter our polarphp
command line program
polar --version
If you get the following output:
polarphp 0.0.1-git (built: 2019-01-27 12:22)
Copyright (c) 2016-2018 The polarphp foundation (https://polar.foundation)
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
Congratulations, you have successfully compiled the polarphp
runtime environment. When compiling the image, we placed a test script in the ~/temp/
folder
if ( function_exists ( ' phpretrieve_version_str ' )) {
echo " version str: " . php retrieve_version_str () . "n" ;
}
if ( function_exists ( ' phpretrieve_major_version ' )) {
echo " major version: " . php retrieve_major_version () . "n" ;
}
if ( function_exists ( ' phpretrieve_minor_version ' )) {
echo " minor version: " . php retrieve_minor_version () . "n" ;
}
if ( function_exists ( ' phpretrieve_patch_version ' )) {
echo " patch version: " . php retrieve_patch_version () . "n" ;
}
You can run the following command:
polar ~/temp/main.php
If there are no errors, you will get the following output:
version str: polarphp 0.0.1-git
major version: 0
minor version: 0
patch version: 1
Thank you for testing polarphp
. If you have any questions, please scan the WeChat QR code below to join the group communication.
At present, we only target users in China, so we use WeChat and QQ
groups to communicate. Below is the QR code. Interested students can scan the code to join:
PS: Please indicate your purpose of visit when scanning the QR code, for example: learning
polarphp
orPHP
enthusiasts
polarphp
conducts secondary development on top of the php
language project and abides by the php
project agreement. For details, please see: Project Agreement
===========================