PHPackages                             johnatas-x/php-deprecation-detector - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. johnatas-x/php-deprecation-detector

ActivePackage[Utility &amp; Helpers](/categories/utility)

johnatas-x/php-deprecation-detector
===================================

Analyzer of PHP code to search issues with deprecated functionality in newer interpreter versions.

1.3.0(1mo ago)28.4k—0%11BSD-3-ClausePHPPHP &gt;=5.4

Since Jan 30Pushed 1y agoCompare

[ Source](https://github.com/johnatas-x/PhpDeprecationDetector)[ Packagist](https://packagist.org/packages/johnatas-x/php-deprecation-detector)[ RSS](/packages/johnatas-x-php-deprecation-detector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (5)Used By (1)

PhpDeprecationDetector
======================

[](#phpdeprecationdetector)

PhpDeprecationDetector - analyzer of PHP code to search usages of deprecated functionality in newer interpreter versions - deprecations detector.

[![Latest Stable Version](https://camo.githubusercontent.com/fea38010bbdb8a85b208faba1dfeaca3db8a63fe2eb9ca1c2f7f522262758e87/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f7068702d6465707265636174696f6e2d6465746563746f722f762f737461626c65)](https://packagist.org/packages/wapmorgan/php-deprecation-detector)[![Total Downloads](https://camo.githubusercontent.com/cef5e78346cbdba68511d46c287ecfd9a4e18054bdde40a1eb8515be5ab6903e/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f7068702d6465707265636174696f6e2d6465746563746f722f646f776e6c6f616473)](https://packagist.org/packages/wapmorgan/php-deprecation-detector)[![License](https://camo.githubusercontent.com/88c754b1e5bbfd4f8831a069987d5a264ac1c62d630a3f2eeb9a50caaf828a00/68747470733a2f2f706f7365722e707567782e6f72672f7761706d6f7267616e2f7068702d6465707265636174696f6e2d6465746563746f722f6c6963656e7365)](https://packagist.org/packages/wapmorgan/php-deprecation-detector)

PhpDeprecationDetector detects:

- Usage of deprecated **functions, variables, constants and ini-directives**.
- Usage of deprecated **functions functionality**.
- Usage of **forbidden names or tricks** (e.g. reserved identifiers in newer versions).

It literally helps you find code that can fail after migration to newer PHP version.

1. [Installation](#installation)
2. [Usage](#usage)

- [Console scanner](#console-scanner)
- [Json report format](#json-report-format)

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

[](#installation)

Phar file
---------

[](#phar-file)

1. Just download a phar from [releases page](https://github.com/wapmorgan/PhpDeprecationDetector/releases) and make executable

```
chmod +x phpdd-x.x.x.phar
```

2. a. **Local installation**: use it from current folder:

    ```
    ./phpdd-x.x.x.phar -h
    ```

    b. **Global installation**: move it in to one of folders listed in your `$PATH` and run from any folder:

    ```
    sudo mv phpdd-x.x.x.phar /usr/local/bin/phpdd
    phpdd -h
    ```

Composer
--------

[](#composer)

Another way to install *phpdd* is via composer.

1. Install composer:

```
curl -sS https://getcomposer.org/installer | php
```

2. Install phpdd in global composer dir:

```
./composer.phar global require wapmorgan/php-deprecation-detector dev-master
```

3. Run from any folder:

```
phpdd -h
```

Usage
=====

[](#usage)

Console scanner
---------------

[](#console-scanner)

To scan your files or folder launch `phpdd` and pass file or directory names.

```
Description:
  Analyzes PHP code and searches issues with deprecated functionality in newer interpreter versions.

Usage:
  scan [options] [--] ...

Arguments:
  files                                    Which files you want to analyze (separate multiple names with a space)?

Options:
  -t, --target[=TARGET]                    Sets target PHP interpreter version. [default: "8.0"]
  -a, --after[=AFTER]                      Sets initial PHP interpreter version for checks. [default: "5.3"]
  -e, --exclude[=EXCLUDE]                  Sets excluded file or directory names for scanning. If need to pass few names, join it with comma.
  -s, --max-size[=MAX-SIZE]                Sets max size of php file. If file is larger, it will be skipped. [default: "1mb"]
      --file-extensions[=FILE-EXTENSIONS]  Sets file extensions to be parsed. [default: "php, php5, phtml"]
      --skip-checks[=SKIP-CHECKS]          Skip all checks containing any of the given values. Pass a comma-separated list for multiple values.
      --output[=OUTPUT]                    The output type required. Options: stdout, json, junit. Defaults to stdout.
      --output-file[=OUTPUT-FILE]          File path to store results where output is not stdout.
  -h, --help                               Display help for the given command. When no command is given display help for the scan command
  -q, --quiet                              Do not output any message
  -V, --version                            Display this application version
      --ansi                               Force ANSI output
      --no-ansi                            Disable ANSI output
  -n, --no-interaction                     Do not ask any interactive question
  -v|vv|vvv, --verbose                     Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

```

- By providing additional option `--target` you can specify version of PHP to perform less checks. Available target versions: 5.3, 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0. A larger version includes rules for checking from all previous.
- By providing `--exclude` option you can exclude specific folders or files from analyze. For example, `--exclude vendor` will prevent checking third-party libraries.
- By providing `--skip-checks` option you can exclude specific checks from analyze.
- If your files has unusual extension, you can specify all exts by `--file-extensions` option. By default, it uses `php`, `phtml` and `php5`.
- If you need to generate machine-readable analyze result, use the `--output-file` option to specify path to store the output file as specified on `--output` (json or junit).

### Example of usage

[](#example-of-usage)

```
> ./bin/phpdd tests/
Max file size set to: 1.000 MiB
Folder /media/wapmorgan/Локальный диск/Документы/PhpDeprecationDetector/tests
- PHP 5.3 (3) - your version is greater or equal
+------------+---------+---------------------------------------------------------------------+
| File:Line  | Type    | Issue                                                               |
+------------+---------+---------------------------------------------------------------------+
| /5.3.php:2 | removed | Function dl() is removed.                                           |
| /5.3.php:3 | removed | Ini define_syslog_variables is removed.                             |
| /5.3.php:5 | changed | Function usage piet() (@call_with_passing_by_reference) is changed. |
|            |         | Call with passing by reference is deprecated. Problem is "&$hoho"   |
+------------+---------+---------------------------------------------------------------------+

- PHP 5.4 (2) - your version is greater or equal
+------------+---------+-----------------------------------------------+
| File:Line  | Type    | Issue                                         |
+------------+---------+-----------------------------------------------+
| /5.4.php:2 | removed | Function mcrypt_generic_end() is removed.     |
|            |         | Consider replace with mcrypt_generic_deinit() |
| /5.4.php:3 | removed | Function magic_quotes_runtime() is removed.   |
+------------+---------+-----------------------------------------------+
...
...
...

```

Json report format
------------------

[](#json-report-format)

Also, you can store analyze result in json format for automatic check. Pass `--output-file=FILENAME` to write result to **FILENAME** file or do not set to output to *stdout*.

Junit report format
-------------------

[](#junit-report-format)

Also, you can store analyze result in junit format for automatic check. Pass `--output-file=FILENAME` to write result to **FILENAME** file or do not set to output to *stdout*.

**Format of json** - dictionary with items:

- InfoMessage\[\] **info\_messages** - list of information messages about analyzing process.
- Issue\[\] **problems** - list of issues found in your code.
- ReplaceSuggestion\[\] **replace\_suggestions** - list of replacement suggestions based on your code.
- Note\[\] **notes** - list of notes about new functions behaviour.

Items description:

- **InfoMessage** structure:
    - string **type** - message type - any of (info | warning)
    - string **message** - message text
- **Issue** structure:
    - string **version** - interpreter version which has current issue (*like 7.2*)
    - string **file** - relative path to file in which issue found (*like src/ProblemClass.php*)
    - string **path** - absolute path to file in which issue found (*like /var/www/html/project/src/ProblemClass.php*)
    - int **line** - line in file in which issue found
    - int **column** - column in line in which issue found
    - string **category** - issue category - any of (changed | removed | violation)
    - string **type** - concrete issue type (*like "constant" or "identifier"*)
    - string **checker** - concrete issue object which may cause problem (*like `magic_quotes_runtime` or `preg_replace() (@preg_replace_e_modifier)`*)
- **ReplaceSuggestion** structure:
    - string **type** - replacement object type (*like variable or ini*)
    - string **problem** - replacement object (*like mcrypt\_generic\_end() or each()*)
    - string **replacement** - suggestion to replace with (*like mcrypt\_generic\_deinit() or foreach()*)
- **Note** structure:
    - string **type** - type of note (*like function\_usage or deprecated\_feature*)
    - string **problem** - note object (*like `preg_replace() (@preg_replace_e_modifier)` or `parse_str() (@parse_str_without_argument)`*)
    - string **note** - note text (*like `Usage of "e" modifier in preg_replace is deprecated: "asdasdsd~ie"` or `Call to parse_str() without second argument is deprecated`*)

Build
=====

[](#build)

```
docker run --rm --interactive --tty --volume $PWD:/app composer:2.2.4 sh
# and inside a container:
docker-php-ext-install bcmath
composer require macfja/phar-builder
echo phar.readonly=0 >> /usr/local/etc/php/php-cli.ini
composer run-script build
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance65

Regular maintenance activity

Popularity28

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.4% 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 ~260 days

Total

4

Last Release

57d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fb82429ffeb7556ffee9014525e0ba5d3a32cf3a525d6a5e48135ccd50626925?d=identicon)[johnatas-x](/maintainers/johnatas-x)

---

Top Contributors

[![wapmorgan](https://avatars.githubusercontent.com/u/6000618?v=4)](https://github.com/wapmorgan "wapmorgan (149 commits)")[![jaggaer-fwolfsjaeger](https://avatars.githubusercontent.com/u/73596490?v=4)](https://github.com/jaggaer-fwolfsjaeger "jaggaer-fwolfsjaeger (7 commits)")[![jamessampford](https://avatars.githubusercontent.com/u/1376843?v=4)](https://github.com/jamessampford "jamessampford (7 commits)")[![kitrio](https://avatars.githubusercontent.com/u/7542987?v=4)](https://github.com/kitrio "kitrio (4 commits)")[![johnatas-x](https://avatars.githubusercontent.com/u/34005481?v=4)](https://github.com/johnatas-x "johnatas-x (3 commits)")[![Axent96](https://avatars.githubusercontent.com/u/29395665?v=4)](https://github.com/Axent96 "Axent96 (3 commits)")[![fwolfsjaeger](https://avatars.githubusercontent.com/u/469206?v=4)](https://github.com/fwolfsjaeger "fwolfsjaeger (2 commits)")[![0cool-f](https://avatars.githubusercontent.com/u/20709003?v=4)](https://github.com/0cool-f "0cool-f (1 commits)")[![wergio](https://avatars.githubusercontent.com/u/1130260?v=4)](https://github.com/wergio "wergio (1 commits)")[![EvgenyOrekhov](https://avatars.githubusercontent.com/u/8045060?v=4)](https://github.com/EvgenyOrekhov "EvgenyOrekhov (1 commits)")[![jure-koren](https://avatars.githubusercontent.com/u/18256888?v=4)](https://github.com/jure-koren "jure-koren (1 commits)")[![NathanGibbs3](https://avatars.githubusercontent.com/u/9939563?v=4)](https://github.com/NathanGibbs3 "NathanGibbs3 (1 commits)")[![phaldan](https://avatars.githubusercontent.com/u/5508270?v=4)](https://github.com/phaldan "phaldan (1 commits)")[![str](https://avatars.githubusercontent.com/u/123817?v=4)](https://github.com/str "str (1 commits)")[![szaimen](https://avatars.githubusercontent.com/u/42591237?v=4)](https://github.com/szaimen "szaimen (1 commits)")

### Embed Badge

![Health badge](/badges/johnatas-x-php-deprecation-detector/health.svg)

```
[![Health](https://phpackages.com/badges/johnatas-x-php-deprecation-detector/health.svg)](https://phpackages.com/packages/johnatas-x-php-deprecation-detector)
```

###  Alternatives

[coenjacobs/mozart

Composes all dependencies as a package inside a WordPress plugin

4723.6M20](/packages/coenjacobs-mozart)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

4743.5k10](/packages/phel-lang-phel-lang)[symfony/ai-bundle

Integration bundle for Symfony AI components

30282.3k6](/packages/symfony-ai-bundle)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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