PHPackages                             afei/php7cc - 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. [CLI &amp; Console](/categories/cli)
4. /
5. afei/php7cc

ActiveProject[CLI &amp; Console](/categories/cli)

afei/php7cc
===========

A command-line tool to check PHP 5.3 - 5.6 code compatibility with PHP 7

3.0.3(6y ago)51872MITPHPPHP &gt;=5.3.3

Since Aug 31Pushed 5y agoCompare

[ Source](https://github.com/kalaGN/php7cc)[ Packagist](https://packagist.org/packages/afei/php7cc)[ RSS](/packages/afei-php7cc/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (8)Versions (9)Used By (0)

PHP 7 Compatibility Checker(php7cc)
===================================

[](#php-7-compatibility-checkerphp7cc)

#### Introduction

[](#introduction)

php7cc is a command line tool designed to make migration from PHP 5.3-5.6 to PHP 7 easier. It searches for potentially troublesome statements in existing code and generates reports containing file names, line numbers and short problem descriptions. It does not automatically fix code to work with the new PHP version.

#### What kind of problems does it detect?

[](#what-kind-of-problems-does-it-detect)

There are 2 types of issues reported by php7cc:

1. **Errors** that will definitely cause some kind of trouble (a fatal, a syntax error, a notice, etc.) on PHP 7. These are highlighted in red.
2. **Warnings** that may or may not lead to logical errors. For example, statements that are legal in both PHP 5 and PHP 7, but change their behaviour between versions fall into this category. Warnings are highlighted in yellow.

A list of statements that may cause errors or warnings to be reported can be found in the [php-src repository](https://github.com/php/php-src/blob/PHP-7.0/UPGRADING).

***Although php7cc tries to detect as much problems as accurately as possible, sometimes 100% reliable detection is very hard to achieve. That's why you should also run a comprehensive test suite for the code you are going to migrate.***

Prerequisites
=============

[](#prerequisites)

To run php7cc, you need php installed, minimum required version is 5.3.3. PHP 7 is supported, but files with syntax errors (for example, invalid numeric literals or invalid UTF-8 codepoint escape sequences) can't be processed. You will only get the warning message about the first syntax error for such files.

You may also need [composer](https://getcomposer.org/) to install php7cc.

Installation
============

[](#installation)

#### Phar package

[](#phar-package)

You can download a phar package for any stable version from the Github [releases](https://github.com/sstalle/php7cc/releases) page.

#### Composer (globally)

[](#composer-globally)

Make sure you have composer installed. Then execute the following command:

```
composer global require afei/php7cc
```

It is also recommended to add global Composer binaries directory to your `PATH` environment variable. The location of this directory depends on the operating system you use (see [Composer documentation](https://getcomposer.org/doc/03-cli.md#composer-home)if you want to know more). The following command should work for some \*nix systems:

```
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
```

This makes it possible to run php7cc by entering just the executable name.

#### Composer (locally, per project)

[](#composer-locally-per-project)

Make sure you have composer installed. Then execute the following command from your project directory:

```
composer require afei/php7cc --dev
```

#### Docker image

[](#docker-image)

A docker image is available on [Docker Hub](https://hub.docker.com/r/ypereirareis/php7cc/)(contributed and maintained by [ypereirareis](https://github.com/ypereirareis)).

Usage
=====

[](#usage)

Examples in this section assume that you have installed php7cc globally using composer and that you have added it's vendor binaries directory to your `PATH`. If this is not the case, just substitute `php7cc` with the correct path to the binary of phar package. For local per project installation the executable will be located at `/vendor/bin/php7cc`.

#### Getting help

[](#getting-help)

To see the full list of available options, run:

```
php7cc --help
```

#### Checking a single file or directory

[](#checking-a-single-file-or-directory)

To check a file or a directory, pass its name as the first argument. Directories are checked recursively.

So, to check a file you could run:

```
php7cc /path/to/my/file.php
```

To check a directory:

```
php7cc /path/to/my/directory/
```

#### Specifying file extensions to check

[](#specifying-file-extensions-to-check)

When checking a directory, you can also specify a comma-separated list of file extensions that should be checked. By default, only .php files are processed.

For example, if you want to check .php, .inc and .lib files, you could run:

```
php7cc --extensions=php,inc,lib /path/to/my/directory/
```

#### Excluding file or directories

[](#excluding-file-or-directories)

You can specify a list of absolute or relative paths to exclude from checking. Relative paths are relative to the checked directories.

So, if you want to exclude vendor and test directories, you could run:

```
php7cc --except=vendor --except=/path/to/my/directory/test /path/to/my/directory/
```

In this example, directories `/path/to/my/directory/vendor`, `/path/to/my/directory/test` and their contents will not be checked.

#### Specifying minimum issue level

[](#specifying-minimum-issue-level)

If you set a minimum issue level, only issues having that or higher severity level will be reported by `php7cc`. There are 3 issue levels: "info", "warning" and "error". "info" is reserved for future use and is the same as "warning".

Example usage:

```
php7cc --level=error /path/to/my/directory/
```

Only errors, but not warnings will be shown in this case.

#### Specifying output format

[](#specifying-output-format)

There are two output format available: `plain` and `json`.

`output-format` command-line option, `o` in short form, can be used in order to change the output format:

```
php7cc -o json /path/to/my/directory/ | json_pp
```

Would output:

```
{
   "summary" : {
      "elapsedTime" : 0.0060338973999023,
      "checkedFiles" : 3
   },
   "files" : [
      {
         "errors" : {},
         "name" : "/path/to/my/directory/myfile.php",
         "warnings" : [
            {
               "text" : "String containing number in hexadecimal notation",
               "line" : 13
            }
         ]
      },
      {
         "warnings" : [
            {
               "line" : 6,
               "text" : "Reserved name \"string\" used as a class, interface or trait name "
            }
         ],
         "name" : "/path/to/my/directory/myfile.php",
         "errors" : {}
      }
   ]
}
```

Troubleshooting
===============

[](#troubleshooting)

#### Maximum function nesting level of 100/250/N reached, aborting!

[](#maximum-function-nesting-level-of-100250n-reached-aborting)

You should increase maximum function nesting level in your PHP or Xdebug config file like this:

```
xdebug.max_nesting_level = 1000
```

#### Allowed memory size of N bytes exhausted

[](#allowed-memory-size-of-n-bytes-exhausted)

You should increase amount of memory available to CLI PHP scripts or disable PHP memory limit. The latter can be done by setting the `memory_limit` PHP option to -1. This option can be set by editing `php.ini` or by passing a command-line argument to PHP executable like this:

```
php -d memory_limit=-1 php7cc.php /path/to/my/directory
```

Other useful links
==================

[](#other-useful-links)

#### Contributing

[](#contributing)

Please read the [contributing guidelines](CONTRIBUTING.md).

#### Credits

[](#credits)

[The list of contributors](https://github.com/afei/php7cc/graphs/contributors) is available on the corresponding Github page.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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 ~222 days

Recently: every ~324 days

Total

8

Last Release

2358d ago

Major Versions

1.2.1 → 3.0.02019-12-03

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16739107?v=4)[Afei ](/maintainers/kalaGN)[@kalaGN](https://github.com/kalaGN)

---

Top Contributors

[![sstalle](https://avatars.githubusercontent.com/u/5349066?v=4)](https://github.com/sstalle "sstalle (156 commits)")[![pyrech](https://avatars.githubusercontent.com/u/2021641?v=4)](https://github.com/pyrech "pyrech (8 commits)")[![kalaGN](https://avatars.githubusercontent.com/u/16739107?v=4)](https://github.com/kalaGN "kalaGN (6 commits)")[![RonRademaker](https://avatars.githubusercontent.com/u/2697738?v=4)](https://github.com/RonRademaker "RonRademaker (3 commits)")[![ba66e77](https://avatars.githubusercontent.com/u/1698983?v=4)](https://github.com/ba66e77 "ba66e77 (2 commits)")[![royopa](https://avatars.githubusercontent.com/u/442991?v=4)](https://github.com/royopa "royopa (2 commits)")[![jejung](https://avatars.githubusercontent.com/u/13054871?v=4)](https://github.com/jejung "jejung (1 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (1 commits)")[![hason](https://avatars.githubusercontent.com/u/288535?v=4)](https://github.com/hason "hason (1 commits)")[![blacksun](https://avatars.githubusercontent.com/u/21370?v=4)](https://github.com/blacksun "blacksun (1 commits)")[![klnjmm](https://avatars.githubusercontent.com/u/15214050?v=4)](https://github.com/klnjmm "klnjmm (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/afei-php7cc/health.svg)

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

###  Alternatives

[psy/psysh

An interactive shell for modern PHP.

9.8k545.6M719](/packages/psy-psysh)[humbug/php-scoper

Prefixes all PHP namespaces in a file or directory.

7963.0M35](/packages/humbug-php-scoper)[povils/phpmnd

A tool to detect Magic numbers in codebase

5795.6M193](/packages/povils-phpmnd)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)

PHPackages © 2026

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