Download the PHP package yangweijie/aot-rector without Composer

On this page you can find all versions of the php package yangweijie/aot-rector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package aot-rector

AOT Rector Rules

将 vendor 目录中的第三方 PHP 代码转换为兼容 Swoole AOT Compiler 语法的自动化工具。

工作原理

规则列表

规则 针对语法 操作
DollarDollarToArrayAccessRector $$var 动态变量 转为 $_dyn_vars[$key]
ExtractToManualAssignmentRector extract() 函数 替换为参数表达式 + 注释提醒
MultiBreakContinueRector break N / continue N 添加注释提醒改用 goto
StringNullByteRector 字符串字面量中含 \0 替换为 "str".chr(0)."续"
FreeCodeToFunctionRector 游离代码(不在函数内) 标记检测结果
ClosureRefParamToRefvalRector 闭包引用参数 &$var 添加注释提醒使用 refval()

安装

配置

1. rector.php

复制模板到项目根目录:

根据项目的 vendor 依赖,在 withSkip 中添加需要跳过的文件:

2. composer.json 脚本

Composer 脚本不会自动从依赖包继承,需要在根项目的 composer.json 中添加:

命令参考

命令 说明
composer aot:rector 完整流程:Rector 转换 → 生成补丁 → 应用到 vendor
composer aot:rector-dry 预览:只显示 Rector 会改哪些文件,不改写
vendor/bin/aot-patch 仅补丁:对比 @aot/ 和 vendor/,生成补丁并应用
composer aot:patch 同上(通过 composer 脚本)

首次运行:

后续如果修改了 patches/ 中的补丁文件,重新执行 composer aot:rector 或 vendor/bin/aot-patch 即可同步到 vendor。

目录说明

跳过规则配置

rector.php 中 withSkip 的常见配置项:

注意:被跳过的文件不会被 Rector 转换,但不影响 AOT 编译。AOT 编译器使用 ZendPHP 自己的解析器而非 Rector 的 nikic/php-parser。

开发

运行测试

测试夹具结构

夹具格式:

Patcher 类

路径解析使用 getcwd() 获取项目根目录,因此可以在任意目录执行。


All versions of aot-rector with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
rector/rector Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yangweijie/aot-rector contains the following files

Loading the files please wait ...