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.
 
 
韩天峰 c7c9a8e263 refactor(php): 重构 SSA 构建器中的返回和抛出表达式检查 3 months ago
bin feat(compiler): 添加性能分析和 objval 函数支持 3 months ago
cases 更新 1 year ago
docs docs(aot): 添加 AOT 编译器优化优先级和 PHP 源码优化器分析文档 3 months ago
examples refactor(php): 重构PHP编译器基础功能并完善类继承支持 3 months ago
perf fix(parser): 修复变量类型推断问题 3 months ago
phpunit test(compiler): 添加类方法重写顺序测试用例 3 months ago
src refactor(php): 重构 SSA 构建器中的返回和抛出表达式检查 3 months ago
tests feat(php): 添加对foreach列表解构语法的支持 3 months ago
web fix 3 years ago
.clang-format update 8 months ago
.gitignore chore(build): 添加 Python 缓存目录到忽略列表 3 months ago
.php-cs-fixer.dist.php Revert "style(config): 更新PHP代码样式配置" 4 months ago
CLAUDE.md docs(project): 添加项目指导文档 CLAUDE.md 3 months ago
LICENSE.md docs(license): 更新版权信息归属 4 months ago
README.md docs(readme): 更新依赖库安装说明 3 months ago
ast.py 支持目录处理 8 months ago
cli.php feat(php): 添加 std::array 类型支持并优化编译器功能 4 months ago
composer.json chore(deps): 更新 swoole/phpx 依赖版本 3 months ago
composer.lock refactor(php): 重构 PHP 编译器基础类以使用 phpx 库 4 months ago
conv.php init 3 years ago
dump.py init 3 years ago
package-on-windows.php feat(build): 更新 Windows 打包脚本以支持新示例和配置文件 4 months ago
package.json feat(build): 添加 Windows 资源文件支持功能 4 months ago
package.sh feat(build): 更新打包脚本支持跨平台优化 4 months ago
phpunit.xml feat(compiler): 添加测试模式和静态变量重复检测功能 5 months ago
project.yml refactor(build): 更新项目配置文件中的编译器路径 3 months ago
py2php.php op 3 years ago
rounds.txt update 8 months ago
run-tests.php feat(tests): 添加编译器路径配置选项支持 3 months ago
swoole-logo.ico feat(build): 添加 Windows 资源文件支持功能 4 months ago
swoole-logo.svg feat(build): 添加 Windows 资源文件支持功能 4 months ago
version.txt test(aot): 添加trait测试用例和decimal类型toString方法测试 3 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/