Home > News content

Polarphp - a new PHP language runtime environment

via:开源中国     time:2019/1/28 7:02:23     readed:187

samePolarphpAlsoZend engineBased on the build, achieved aWebA completely new operating environment outside of development.

Project official website library:

Https://gitee.com/polarphp/polarphp

Https://github.com/polarphp/polarphp

Welcome friends a lot of star ^ _ ^

Why launch the polarphp project

along withGowithNodeJSStrong rise,PHPMarket share is gradually being eaten, andPHPThe official is still sticking toWebIn the field of programming, the more things you want to keep, the more you can't keep it.PolarphpLearn fromNodeJSwithGoRelated characteristicszendVMRepackage, removePHPSome ancient deprecated features and strongWebAttributes by implementing a new set of runtime frameworksLibpdk,willPHPLanguage is a true universal scripting language, empoweringPHPLet it have asynchronous programming, coroutines, threads, built-inUnicodeSupport, standard fileIOAnd so on, letPHPProgrammers can not only doWebApplications can also face real server applications with ease.

Infrastructure provided by polarphp

  1. Directly facing the terminal, remove itSAPISo that the server environment can be better realized.

  2. NormalizationOPCODEForm a specification to provide a similarPycThe precompilation mechanism for files.

  3. Provide native multi-threading support, learn fromJavaA programming paradigm in terms of multithreading.

  4. Provide native asynchronousIOstand by.

  5. Provide for stringsUnicodestand by.

  6. Provide a brand new package organization, built-in package dependency management tools, similarCargowithNpm.

  7. Built inAPIDocument generation tool.

Polarphp roughly architecture

The project is mainly composed of three parts, mainly including the following three sub-modules

  1. Polarvm

  2. zendAPI

  3. Libpdk

The approximate relationship of this module is as follows:

Polarvm <=> zendAPI <=> libpdk

Polarvm introduction

Realize the current stageZend engineEncapsulation to achieve the most basicPHPExecution environment, such as implementation:

  1. Language analysis,OPCODEExecution.

  2. Implement the underlying runtime environment, implement variable operations, array operations, class loading mechanisms, language reflections, and more.

  3. Zend engineThe initialization, the language engine and the terminal link, to achieve direct control of the standard input and output of the language engine.

  4. Implement a callback mechanism between the language engine and the standard library.

Introduction to zendAPI

DonePHPExtended friends should know that when we develop extensions,Zend engineMany of the interfaces are provided by means of macro calls. The types are not safe, the debugging is not good, and some macros are still very special. It is especially cumbersome to manipulate arrays.Zend engineofGcIs achieved by reference counting, whileCThere is no language that helps us manage the counting mechanism from the language level, so managing memory when we write extensions is not only cumbersome but also causes memory leaks if we are not careful. Especially when copying andPHPWhen using references between variables together, it is very difficult to get a headache.

If our standard library is directly based on nativeZend engineInterface, it is bound to expand, maintainability will be seriously affected, especially at presentPolarvmis based onZend engineUnder the considerable circumstances of secondary development. So implement a shield between the language engine and the standard library, and implement the pairZend engineThe native interface is packaged to provide a relatively stable and simple object-orientedCPPProgramming interface.

The zendAPI provides the following features:

  1. Fully object oriented, rightZend Engine APISecondary definition

  2. Using modernC++11Grammar for development, easy to maintain

  3. Maximize shieldingPHPThe impact of the version on extended development,zendAPIWill be rightZend Engine APIDifferent versions bring out the difference

  4. High coverage unit testing to ensure code quality

  5. As much as possible to ensure performance when packaging

  6. Committed to binary compatibility of project libraries

Libpdk introduces the development plan of polarphp

Due to limited development resources, the development plan is tentatively scheduled as follows:

  1. useCmakeCorrectZend VMCompile and generatePolarphpCustomized versionPHPLanguage virtual machine.

  2. Language support project, language testing framework, portingLLVMThe projectLitTest framework.

  3. achievePolarphpThe driver implements PHP code from the command line.

  4. CorrectPolarphpThe virtual machine performs regression testing and tentatively runs the language virtual machine related regression test of PHP.

  5. achievePolarphpBuilt-in functions.

  6. Publishing core virtual machinesDockerMirroring.

  7. IntegrationLibpdkRuntime framework.

  8. Achieve user-friendly installation, try to do it in the least possible stepsPolarphpinstallation.

  9. Implement the package manager.

  10. Implement language-assisted gadgets, such as document generation tools.

Polarphp current status

The project is currently in a very early stage, throughDockerMirror to achieve the iterative release of the project, currently I am mainly developing in my spare time, welcome everyone to play. An important task in 2019 is to improvePolarphpStandard libraryLibpdkAnd achieving mainstreamLinuxStable operation on the operating system.

How to participate

At present, we only target Chinese users for the time being, so we use the communication method of WeChat and QQ group. The following is the QR code. Interested students can scan the code to join:

Currently have the following working groups

  1. Language core team

  2. Standard library team

  3. Eco-chain project team

  4. Document team

  5. officialwebsiteMaintenance team

China IT News APP

Download China IT News APP

Please rate this news

The average score will be displayed after you score.

Post comment

Do not see clearly? Click for a new code.

User comments