TrendWhat rose on GitHub, every day at 07:30 KST · 한국어

GitHub · as of November 8, 2026 · View on GitHub →

swoole/typephp

PHP native compiler

+10 stars in 7 days

Developers can compile PHP into native machine code without an interpreter

TypePHP is an AOT (Ahead-Of-Time) tool that converts PHP source code into C++ and compiles it into a native binary, PHP extension, or shared library. This process allows PHP scripts to run directly on the CPU as machine code without a separate interpreter. It maintains existing PHP syntax while using type information at compile time to generate optimized code.

Native execution without an interpreter

TypePHP does not convert PHP code to bytecode for execution; instead, it lowers it to C++17 code and compiles it into native machine code. During this process, primitive types like int, float, and bool are mapped directly to C++ scalar types, allowing numeric operations to be converted into CPU instructions. The compiler itself is written in PHP, and the tpc binary is generated by compiling the TypePHP compiler's PHP source, creating a self-hosting structure. Because there is no opcode interpretation or JIT warm-up at runtime, startup time is fast and performance is deterministic.

Three build modes and precise numeric support

The same codebase can be built in three forms: a native executable (bin), a PHP extension (ext), and a shared library (lib).

  • Native executable Creates a binary that runs independently without PHP CLI. Since the source code is converted to machine code, this provides source protection during distribution.
  • PHP extension and library Allows compiled functions or classes to be loaded as extensions in existing PHP projects, or built as shared libraries for reuse in other projects.
  • Precise numeric types For integers with 54 or more digits or operations requiring no floating-point error, use bigInt, decimal, and bigFloat to obtain accurate results.

Compatibility scope and limitations

TypePHP intentionally supports a testable subset of PHP rather than all dynamic PHP programs. The global scope allows only declarations, and executable statements must be inside functions or methods. In binary mode, the signature of the main() function is strictly defined. Inferred int, float, and bool variables use fixed native storage by default, so they cannot be changed to incompatible types later. Some dynamic references, closures, and reflection patterns are intentionally unsupported, so you must verify the compatibility model and list of incompatible features before introducing it into existing applications.

Environment and conditions to check before adoption

Using TypePHP requires PHP 8.4 or 8.5 CLI, development headers, and php-config. On Unix-like systems, the embedded library for the corresponding PHP version (libphp.so or libphp.dylib) is required for building binaries or shared libraries. You must have GCC 9 or later or Clang, CMake 3.24 or later, and Composer 2 installed, along with GMP and MPFR libraries for precise numeric operations. Linux x64 is the primary development and testing platform, but Windows, macOS, ARM64, Android, iOS, and WASI backends are also supported. For mobile app development, it is possible to write UI structure and business logic in TypePHP while maintaining a thin native UI bridge. Using the --nano option allows compiling PHP Nano and PHPX source directly without the Zend opcode interpreter to create lighter executables, but in this case, VM entry paths like eval and include, as well as anonymous classes, cannot be used.

Written by AI from this repository's README on September 30, 2026. For the facts, the original on GitHub is the reference.

By the numbers

GitHub trending history
1 day between Jun 19, when Trend began recording, and Nov 8, 2026 · first on Aug 29 · best daily rank #13 (Aug 29)

Read from GitHub, as of November 8, 2026.

Language
PHP
Stars
1,475
Stars gained in 7 days
+10
Contributors
20
Forks
79
Latest release
v0.9.5 · October 13, 2026
Commits
1,929
Last commit
November 5, 2026
Open issues
1
Open pull requests
1

View on GitHub → · Homepage

README badge

trend.ondo.sh · GitHub daily trending #13 · August 29, 2026

The badge above shows the highest this repository has ranked on GitHub's daily trending since June 19, 2026, and the day it did. Paste the Markdown below into your README. The badge opens this page, and it updates by itself when the repository climbs higher.

[![trend.ondo.sh](https://trend.ondo.sh/github/r/swoole--typephp/badge.en.svg)](https://trend.ondo.sh/github/r/swoole--typephp/en.html)