2017 © Pedro Peláez
 

package php-code-analyzer

A program that finds usage of different non-built-in extensions in your php code.

image

wapmorgan/php-code-analyzer

A program that finds usage of different non-built-in extensions in your php code.

  • Tuesday, May 1, 2018
  • by wapmorgan
  • Repository
  • 5 Watchers
  • 65 Stars
  • 11,405 Installations
  • PHP
  • 3 Dependents
  • 1 Suggesters
  • 5 Forks
  • 2 Open issues
  • 6 Versions
  • 26 % Grown

The README.md

PhpCodeAnalyzer

PhpCodeAnalyzer finds usage of different non-built-in extensions in your php code. This tool helps you understand how transportable your code between php installations is., (*1)

Latest Stable Version Total Downloads License, (*2)

TOC

Example of usage

To scan your files or folder launch phpca and pass file or directory names. ``` sh, (*3)

phpca ..\HttpServer Scanning ..\HttpServer ... [spl] Function "spl_autoload_register" used in file ..\HttpServer/vendor/composer/ClassLoader.php[258] [spl] Function "spl_autoload_unregister" used in file ..\HttpServer/vendor/composer/ClassLoader.php[266] [spl] Function "spl_autoload_register" used in file ..\HttpServer/vendor/composer/autoload_real.php[22] [spl] Function "spl_autoload_unregister" used in file ..\HttpServer/vendor/composer/autoload_real.php[24], (*4)

Used non-built-in extensions in your code: - [spl] Standard PHP Library (SPL). This extension is bundled with php since PHP 5.0.0. Extension is available in pecl: spl., (*5)


You can skip progress with `--no-progress` option: ``` sh > phpca --no-progress ..\yii-1.1.16.bca042\framework\caching Scanning ..\yii-1.1.16.bca042\framework\caching ... Used non-built-in extensions in your code: - [apc] Alternative PHP Cache. Extension is available in pecl: apc. - [wincache] Windows Cache for PHP. Extension is available in pecl: wincache.

Also, you can keep only progress with --no-report option: ``` sh, (*6)

phpca --no-report ..\yii-1.1.16.bca042\framework\caching Scanning ..\yii-1.1.16.bca042\framework\caching ... [apc] Function "apc_fetch" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[46] [apc] Function "apc_fetch" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[56] [apc] Function "apc_store" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[70] [apc] Function "apc_add" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[84] [apc] Function "apc_delete" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[95] [apc] Function "apc_clear_cache" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[107] [apc] Function "apc_clear_cache" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[109] [wincache] Function "wincache_ucache_get" used in file ..\yii-1.1.16.bca042\framework\caching/CWinCache.php[46] [wincache] Function "wincache_ucache_get" used in file ..\yii-1.1.16.bca042\framework\caching/CWinCache.php[56] [wincache] Function "wincache_ucache_set" used in file ..\yii-1.1.16.bca042\framework\caching/CWinCache.php[70] [wincache] Function "wincache_ucache_add" used in file ..\yii-1.1.16.bca042\framework\caching/CWinCache.php[84] [wincache] Function "wincache_ucache_delete" used in file ..\yii-1.1.16.bca042\framework\caching/CWinCache.php[95] [wincache] Function "wincache_ucache_clear" used in file ..\yii-1.1.16.bca042\framework\caching/CWinCache.php[106], (*7)


If you want to see only usage of one specific extension, use `--extension=` option: ``` sh > phpca --extension=apc ..\yii-1.1.16.bca042\framework\caching Scanning ..\yii-1.1.16.bca042\framework\caching ... [apc] Function "apc_fetch" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[46] [apc] Function "apc_fetch" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[56] [apc] Function "apc_store" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[70] [apc] Function "apc_add" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[84] [apc] Function "apc_delete" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[95] [apc] Function "apc_clear_cache" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[107] [apc] Function "apc_clear_cache" used in file ..\yii-1.1.16.bca042\framework\caching/CApcCache.php[109]

Summary report in this case will not be added at the end., (*8)

Help

Full list of available options:, (*9)

> phpca -h
PhpCodeAnalyzer
Usage:
    phpca [-v] [-q] [--output=<path>] [--no-report] [--no-progress] [--since-version=<version>] FILES...
    phpca [-v] [-q] [--output=<path>] --extension=<ext> FILES...
    phpca -h

Options:
  -h --help                 Show this text
  -v --verbose              Show more debug text
  -q --quiet                Don't print any messages
  --output=<path>           Path where to generate XML report
  --extension=<ext>         Look for usage a specific extension
  --no-report               Turn off summary report
  --no-progress             Turn off progress
  --since-version=<version> Only include extensions not included since version

Installation

Phar

  1. Just download a phar from releases page and make executable, (*10)

    chmod +x phpca.phar
    
  2. a. Local installation: use it from current folder:, (*11)

    ./phpca.phar -h
    

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

    sudo mv phpca.phar /usr/local/bin/phpca
    phpca -h
    

Composer

Another way to install phpca is via composer., (*13)

  1. Install composer:, (*14)

    curl -sS https://getcomposer.org/installer | php
    
  2. Install phpcf in global composer dir:, (*15)

    ./composer.phar global require wapmorgan/php-code-analyzer dev-master
    
  3. Run from any folder:, (*16)

    phpca -h
    

The Versions

01/05 2018

dev-master

9999999-dev

A program that finds usage of different non-built-in extensions in your php code.

  Sources   Download

BSD-3-Clause

The Requires

 

code analysis command-line utility

10/05 2017

1.0.4

1.0.4.0

A program that finds usage of different non-built-in extensions in your php code.

  Sources   Download

BSD-3-Clause

The Requires

 

code analysis command-line utility

17/02 2017

1.0.3

1.0.3.0

A program that finds usage of different non-built-in extensions in your php code.

  Sources   Download

BSD-3-Clause

The Requires

 

code analysis command-line utility

05/02 2017

1.0.2

1.0.2.0

A program that finds usage of different non-built-in extensions in your php code.

  Sources   Download

BSD-3-Clause

The Requires

 

code analysis command-line utility

07/12 2016

1.0.1

1.0.1.0

A program that finds usage of different non-built-in extensions in your php code.

  Sources   Download

BSD-3-Clause

The Requires

 

code analysis command-line utility

12/05 2015

v1.0.0

1.0.0.0

A program that finds usage of different non-built-in extensions in your php code.

  Sources   Download

BSD-3-Clause

The Requires

 

code analysis command-line utility