alexia/php7mar
最新稳定版本:v0.2.0-beta
Composer 安装命令:
composer create-project alexia/php7mar
包简介
PHP 7 MAR, or just "php7mar", is a command line utility to generate reports on existing PHP 5 code to assist developers in porting their code quickly to PHP 7.
关键字:
README 文档
README
What is PHP 7 Migration Assistant Report(MAR)?
PHP 7 MAR, or just "php7mar", is a command line utility to generate reports on existing PHP 5 code to assist developers in porting their code quickly to PHP 7. It will run against invididual files or entire project folders. Reports contain line numbers, issues noted, and suggested fixes along with documentation links.
Will php7mar automatically fix my code?
No, php7mar does implement a full lexer to determine code changes and can not determine the intent of the code. It uses lexer tokenizing, string matching, and regular expressions to find syntax changes that may cause issues when porting code to PHP 7. As well, it will detect code snippets in comments and report them as it can not distinguish it as commented code.
What has changed in PHP 7? (Read This!)
If you are currently unfamiliar with what will change moving to PHP 7 then read the UPGRADING file in the current master branch of php-src. Understanding these changes is important to reading the reports generated by php7mar.
Does it handle very poorly styled code?
Very poorly styled code will not parse well, but assuming there is at least some structure to the code style it should still parse. If the code is entirely too poorly formatted there are several web sites that can be used to clean up source code.
- http://www.phpformatter.com/ (Does not support PHP 5.4 [] array syntax.)
- http://phpbeautifier.com/
- http://phpcodecleaner.com/
Usage
First, start by downloading or cloning this repository. It does not need to be placed inside the folder containing the source code.
To begin, type on the command line:
php mar.php This will produce a list of available arguments and switches.
Typical usage would appear as:
php mar.php -f="/path/to/file/example.php" Or:
php mar.php -f="/path/to/folder/example/" This would run against the example file or folder and save the resulting report into a reports folder inside the php7mar folder. When referencing the file or folder to run against it is recommend to use a fully qualified path. Relative paths are supported, but will be relative to the location of the php7mar folder.
Give a try, use the included testcases.php to generate a report:
php mar.php -f="testcases.php" Available Options:
-f
Path to the file or folder to run against. The location of the file or folder to use for generating the report. A fully qualified path is recommended. Relative paths will be based off the php7mar folder. *Example: -f="/path/to/folder"* -r
Path to the folder to save the report. The location to save the final report. By default this saves into the reports/ folder inside the php7mar folder. A fully qualified path is recommended. Relative paths will be based off the php7mar folder. *Example: -r="/path/to/folder"* -t
Types of tests to run. By default all tests will run. This option allows tests to be selected using a comma delimited list. Allowable values: critical, nuance, and syntax. *Example: -t="syntax,nuance"* -x
List of file extension(s) to process. By default *.php files are processed. *Example: -x="php,inc"* --php
File path to the PHP binary to use for syntax checking. If this option is not used syntax checking will use the default PHP installtion to test syntax. *Example: --php="/path/to/php/binary/php"* Test Types
Critical
Critical tests look for issues that will cause broken code, compilation errors, or otherwise create code that works in unintended manors.
Nuance
Nuance tests look for issues that might cause silent underisable code behavior. These tests can report many false positives as they can not determine the intent of the code being checked.
Syntax
A basic command line based syntax checker that checks all files for standard syntax issues. This is useful for double checking work after making many mass find and replace operations. Please note that syntax checking adds a significant increase to processing time especially for large code bases. To run without syntax checking use the -t option and omit syntax; -t="critical,nuance"
alexia/php7mar 适用场景与选型建议
alexia/php7mar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 71.73k 次下载、GitHub Stars 达 772, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「migration」 「php5」 「PHP7」 「porting」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alexia/php7mar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alexia/php7mar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alexia/php7mar 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
php7ify is a project that brings new php7 classes and exceptions to php 5.x.
Provides a simple, chainable wrapper for creating and sending emails using the PHP mail() function.
Creates an XML file for a Single Euro Payments Area (SEPA) Credit Transfer.
Lets you add foreign keys in a swift! Foreign key adder in laravel migration.
It's a barebone security class written on PHP
PHP5 debug helper
统计信息
- 总下载量: 71.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 772
- 点击次数: 32
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2026-01-04