wapmorgan/php-code-analyzer
Composer 安装命令:
composer require wapmorgan/php-code-analyzer
包简介
A program that finds usage of different non-built-in extensions in your php code.
README 文档
README
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.
TOC
Example of usage
To scan your files or folder launch phpca and pass file or directory names.
> 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] 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.
You can skip progress with --no-progress option:
> 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:
> 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]
If you want to see only usage of one specific extension, use --extension= option:
> 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.
Help
Full list of available options:
> 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
- Just download a phar from releases page and make executable
chmod +x phpca.phar
-
a. Local installation: use it from current folder:
./phpca.phar -hb. Global installation: move it in to one of folders listed in your
$PATHand run from any folder:sudo mv phpca.phar /usr/local/bin/phpca phpca -h
Composer
Another way to install phpca is via composer.
- Install composer:
curl -sS https://getcomposer.org/installer | php
- Install phpcf in global composer dir:
./composer.phar global require wapmorgan/php-code-analyzer dev-master
- Run from any folder:
phpca -h
wapmorgan/php-code-analyzer 适用场景与选型建议
wapmorgan/php-code-analyzer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 148.19k 次下载、GitHub Stars 达 96, 最近一次更新时间为 2015 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「code analysis」 「command-line utility」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wapmorgan/php-code-analyzer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wapmorgan/php-code-analyzer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wapmorgan/php-code-analyzer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Memio's PrettyPrinter, used to generate PHP code from given Model
TwigStan is a static analyzer for Twig templates powered by PHPStan
A help command for Minicli
Sentiment analysis library for PHP.
Database Standardization and Analysis Tool for Laravel
Command-line utility for Vtiger CRM.
统计信息
- 总下载量: 148.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 96
- 点击次数: 32
- 依赖项目数: 6
- 推荐数: 1
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-05-04