PHPackages                             chrishalbert/php7mar - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. chrishalbert/php7mar

ActiveProject[Database &amp; ORM](/categories/database)

chrishalbert/php7mar
====================

PHP7Mar with an -x '@exclude' option to ignore nuances that you verified works in php7. "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.

v0.3.2-beta(7y ago)14.1k1GPL-3.0PHPPHP &gt;=5.4.0

Since May 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/chrishalbert/php7mar)[ Packagist](https://packagist.org/packages/chrishalbert/php7mar)[ Docs](https://github.com/Alexia/php7mar)[ RSS](/packages/chrishalbert-php7mar/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (3)DependenciesVersions (10)Used By (0)

Introduction
============

[](#introduction)

#### What is PHP 7 Migration Assistant Report(MAR)?

[](#what-is-php-7-migration-assistant-reportmar)

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?

[](#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!)

[](#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](https://github.com/php/php-src/blob/PHP-7.0.0/UPGRADING). Understanding these changes is important to reading the reports generated by php7mar.

#### Does it handle very poorly styled code?

[](#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.

-  (Does not support PHP 5.4 \[\] array syntax.)
-
-

Usage
=====

[](#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:
------------------

[](#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"*

```

**-e**

```
	Exclusion tags that you can add above a line that is being flagged. Most useful for nuances which will remain in subsequent reports.
		*Example: -e="@ignoreNextLine"*
		Code:
		// @ignoreNextLine
		foreach ($array as &$byRef) {

```

**--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
==========

[](#test-types)

Critical
--------

[](#critical)

Critical tests look for issues that will cause broken code, compilation errors, or otherwise create code that works in unintended manors.

Nuance
------

[](#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
------

[](#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"

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 79.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~190 days

Recently: every ~294 days

Total

8

Last Release

2675d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2a36d01e69089e5e2e2eceb931f79daf20d7a565a0903541edf949479c9ae471?d=identicon)[chrishalbert](/maintainers/chrishalbert)

---

Top Contributors

[![Alexia](https://avatars.githubusercontent.com/u/248632?v=4)](https://github.com/Alexia "Alexia (74 commits)")[![macbre](https://avatars.githubusercontent.com/u/1929317?v=4)](https://github.com/macbre "macbre (7 commits)")[![chrishalbert](https://avatars.githubusercontent.com/u/16158060?v=4)](https://github.com/chrishalbert "chrishalbert (5 commits)")[![xPaw](https://avatars.githubusercontent.com/u/613331?v=4)](https://github.com/xPaw "xPaw (3 commits)")[![valentintorikian](https://avatars.githubusercontent.com/u/389922?v=4)](https://github.com/valentintorikian "valentintorikian (1 commits)")[![willbonde](https://avatars.githubusercontent.com/u/495724?v=4)](https://github.com/willbonde "willbonde (1 commits)")[![x3rAx](https://avatars.githubusercontent.com/u/2268851?v=4)](https://github.com/x3rAx "x3rAx (1 commits)")[![bryant1410](https://avatars.githubusercontent.com/u/3905501?v=4)](https://github.com/bryant1410 "bryant1410 (1 commits)")

---

Tags

migrationphp5PHP7porting

### Embed Badge

![Health badge](/badges/chrishalbert-php7mar/health.svg)

```
[![Health](https://phpackages.com/badges/chrishalbert-php7mar/health.svg)](https://phpackages.com/packages/chrishalbert-php7mar)
```

###  Alternatives

[rector/rector

Instant Upgrade and Automated Refactoring of any PHP code

10.3k123.1M6.0k](/packages/rector-rector)[ifsnop/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k5.5M69](/packages/ifsnop-mysqldump-php)[kitloong/laravel-migrations-generator

Generates Laravel Migrations from an existing database

2.9k7.4M24](/packages/kitloong-laravel-migrations-generator)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k22.9k](/packages/clouddueling-mysqldump-php)[ssch/typo3-rector

Instant fixes for your TYPO3 PHP code by using Rector.

2592.8M263](/packages/ssch-typo3-rector)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
