Phpdcd
Dead Code Detector (DCD) for PHP code.
Install / Use
/learn @sebastianbergmann/PhpdcdREADME
This project is no longer maintained and its repository is only kept for archival purposes.
PHP Dead Code Detector (PHPDCD)
phpdcd is a Dead Code Detector (DCD) for PHP code. It scans a PHP project for all declared functions and methods and reports those as being "dead code" that are not called at least once.
Limitations
As PHP is a very dynamic programming language, the static analysis performed by phpdcd does not recognize function or method calls that are performed using one of the following language features:
- Reflection API
call_user_func()andcall_user_func_array()- Usage of the
newoperator with variable class names - Variable class names for static method calls such as
$class::method() - Variable function or method names such as
$function()or$object->$method() - Automatic calls to methods such as
__toString()orIterator::*()
Also note that infering the type of a variable is limited to type-hinted arguments (function foo(Bar $bar) {}) and direct object creation ($object = new Clazz)
Installation
PHP Archive (PHAR)
The easiest way to obtain PHPDCD is to download a PHP Archive (PHAR) that has all required dependencies of PHPDCD bundled in a single file:
wget https://phar.phpunit.de/phpdcd.phar
chmod +x phpdcd.phar
mv phpdcd.phar /usr/local/bin/phpdcd
You can also immediately use the PHAR after you have downloaded it, of course:
wget https://phar.phpunit.de/phpdcd.phar
php phpdcd.phar
Composer
Simply add a dependency on sebastian/phpdcd to your project's composer.json file if you use Composer to manage the dependencies of your project. Here is a minimal example of a composer.json file that just defines a development-time dependency on PHPDCD:
{
"require-dev": {
"sebastian/phpdcd": "*"
}
}
For a system-wide installation via Composer, you can run:
composer global require 'sebastian/phpdcd=*'
Make sure you have ~/.composer/vendor/bin/ in your path.
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。


