Download the PHP package phpmd/phpmd without Composer

On this page you can find all versions of the php package phpmd/phpmd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpmd

PHPMD

PHPMD is a spin-off project of PHP Depend and aims to be a PHP equivalent of the well known Java tool PMD. PHPMD can be seen as an user friendly frontend application for the raw metrics stream measured by PHP Depend.

https://phpmd.org

Latest Stable Version License AppVeyor Build Status Codecov Status Scrutinizer Build Status Scrutinizer Code Quality Chat with us on Gitter Monthly downloads Total downloads

Installation

See https://phpmd.org/download/index.html

Command line usage

Type phpmd [filename|directory[,filename|directory[,...]]] [report format] [ruleset file], i.e: :

mapi@arwen ~ $ phpmd php/PDepend/DbusUI/ xml rulesets.xml

While the rulesets.xml ruleset file could look like this:

xml

<?xml version="1.0"?> <ruleset name="My first PHPMD rule set" xmlns="http://pmd.sf.net/ruleset/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" xsi:noNamespaceSchemaLocation=" http://pmd.sf.net/ruleset_xml_schema.xsd"> <description> My custom rule set that checks my code... </description>

<rule ref="rulesets/codesize.xml" /> <rule ref="rulesets/cleancode.xml" /> <rule ref="rulesets/controversial.xml" /> <rule ref="rulesets/design.xml" /> <rule ref="rulesets/naming.xml" /> <rule ref="rulesets/unusedcode.xml" />

</ruleset>

The xml report would like like this:

xml

<?xml version="1.0" encoding="UTF-8" ?> <pmd version="0.0.1" timestamp="2009-12-19T22:17:18+01:00"> <file name="/projects/pdepend/PHP/Depend/DbusUI/ResultPrinter.php"> <violation beginline="81" endline="81" rule="UnusedFormalParameter" ruleset="Unused Code Rules" externalInfoUrl="https://phpmd.org/rules/unusedcode.html#unusedformalparameter" priority="3"> Avoid unused parameters such as '$builder'. </violation> </file> </pmd>

You can pass a comma-separated string with list of file names or a directory names, containing PHP source code to PHPMD.

The PHPMD Phar distribution includes the rule set files inside its archive, even if the "rulesets/codesize.xml" parameter above looks like a filesystem reference.

Command line options

Using multiple rule sets

PHPMD uses so called rule sets that configure/define a set of rules which will be applied against the source under test. The default distribution of PHPMD is already shipped with a few default sets, that can be used out-of-box. You can call PHPMD's cli tool with a set's name to apply this configuration: :

~ $ phpmd /path/to/source text codesize

But what if you would like to apply more than one rule set against your source? You can also pass a list of rule set names, separated by comma to PHPMD's cli tool: :

~ $ phpmd /path/to/source text codesize,unusedcode,naming

You can also mix custom rule set files with build-in rule sets: :

~ $ phpmd /path/to/source text codesize,/my/rules.xml

That's it. With this behavior you can specify you own combination of rule sets that will check the source code.

Using multiple source files and folders `

PHPMD can also read the standard input `stdin`: :

~ $ cat src/MyService.php | phpmd - text my/rules.xml

So the PHP code to be scanned may be generated by an other program not necessarily to be store in file.

Exit codes

PHPMD's command line tool currently defines four different exit codes.

Renderers

At the moment PHPMD comes with the following renderers:

Baseline

For existing projects a violation baseline can be generated. All violations in this baseline will be ignored in further inspections.

The recommended approach would be a phpmd.xml in the root of the project. To generate the phpmd.baseline.xml next to it:

~ $ phpmd /path/to/source text phpmd.xml --generate-baseline

To specify a custom baseline filepath for export:

~ $ phpmd /path/to/source text phpmd.xml --generate-baseline --baseline-file /path/to/source/phpmd.baseline.xml

By default PHPMD will look next to phpmd.xml for phpmd.baseline.xml. To overwrite this behaviour:

~ $ phpmd /path/to/source text phpmd.xml --baseline-file /path/to/source/phpmd.baseline.xml

To clean up an existing baseline file and only remove no longer existing violations:

~ $ phpmd /path/to/source text phpmd.xml --update-baseline

PHPMD for enterprise

Available as part of the Tidelift Subscription.

The maintainers of PHPMD and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

Contributing

If you want to contribute to PHPMD, please consult the contribution guide.


All versions of phpmd with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.9
ext-xml Version *
composer/xdebug-handler Version ^1.0 || ^2.0 || ^3.0
pdepend/pdepend Version ^2.16.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package phpmd/phpmd contains the following files

Loading the files please wait ....