TypePHP 编译器 https://swoole.com/aot/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
韩天峰 a9e93eda28 feat(generator): add call argument generator trait for function call handling 2 months ago
.claude/plans docs(architecture): 添加代码复用改进计划和封装审查文档 2 months ago
.github fix(compiler): resolve bitwise not operation on class constants in AOT compilation 2 months ago
bin refactor(core): rename PhpAot namespace to TypePhp across codebase 2 months ago
debug fix(php): resolve native property assignment type checking and conversion issues 2 months ago
docs docs: update documentation references and compiler CLI guide 2 months ago
examples feat(runtime): enhance AOT exception reporting with source file location 2 months ago
perf refactor(php): 优化对象属性获取逻辑并添加性能测试 2 months ago
phpunit feat(parser): add support for PHP 8.4 property hooks and asymmetric visibility 2 months ago
samples test(samples): 添加新测试用例和示例脚本 2 months ago
src feat(generator): add call argument generator trait for function call handling 2 months ago
tests feat(runtime): enhance AOT exception reporting with source file location 2 months ago
.clang-format update 8 months ago
.gitignore feat(build): add library build mode with proper target naming 2 months ago
.php-cs-fixer.dist.php Revert "style(config): 更新PHP代码样式配置" 4 months ago
CLAUDE.md fix(compiler): resolve bitwise not operation on class constants in AOT compilation 2 months ago
LICENSE.md docs(license): 更新版权信息归属 4 months ago
README.md docs(readme): 更新依赖库安装说明 3 months ago
app.manifest feat(build): 支持 Windows 应用程序清单文件配置 2 months ago
ast.py 支持目录处理 8 months ago
clean-elf.sh chore(build): 更新版本号并优化打包脚本 2 months ago
cli.php feat(php): 添加 std::array 类型支持并优化编译器功能 4 months ago
composer.json refactor(docs): update file paths and directory structure references 2 months ago
composer.lock chore(deps): 更新项目依赖包到最新版本 2 months ago
package-on-windows.php rename(project): refactor Swoole-Compiler to TypePHP 2 months ago
package.json feat(build): 添加 Windows 资源文件支持功能 4 months ago
package.sh feat: 将打包产物重命名为tpc 2 months ago
phpunit.xml feat(compiler): 添加测试模式和静态变量重复检测功能 5 months ago
project.yml refactor(docs): update file paths and directory structure references 2 months ago
rounds.txt update 8 months ago
run-tests.php 修复 Windows 运行测试 (#1) 2 months ago
swoole-logo.ico feat(build): 添加 Windows 资源文件支持功能 4 months ago
swoole-logo.svg feat(build): 添加 Windows 资源文件支持功能 4 months ago
version.txt feat(build): add support for building shared libraries in addition to binaries and extensions 2 months ago

README.md

依赖

  • 需要 PHP-8.2 以上版本
  • 需要 GCC-9 以上版本,支持 C++17 标准
  • 需要 CMake-3.24 以上版本
  • 需要高精度数学库:GMPMPFRlibmpdec
# Ubuntu/Debian
sudo apt install libgmp-dev libmpfr-dev libmpdec-dev

# RHEL/CentOS/Fedora
sudo dnf install gmp-devel mpfr-devel libmpdec-devel

# Arch Linux
sudo pacman -S gmp mpfr mpdecimal

GMP 用于 BigInt 任意精度整数,MPFR 用于 BigFloat 高精度浮点数,libmpdec 用于 Decimal 十进制高精度小数。

预览版目前仅支持 Linux 系统,建议使用 Ubuntu 22.04

PHP

必须包含 embed 模块

PHPX

可使用 composer install 安装依赖。 进入 vendor/swoole/phpx 目录,编译 phpx

cd vendor/swoole/phpx
cmake .
make -j32

动态链接库

sudo ldconfig -p | grep php

必须包含 libphp.solibphpx.so

若编译完成,但找不到动态链接库,需要修改

vim /etc/ld.so.conf.d/swoole.conf 

添加路径

/home/swoole/workspace/projects/phpx/lib
/opt/php-8.4/lib/