Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 8, 2024 via composer

slevomat/coding-standard 8.14.1

Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.
Package summary
Share
0
issues
2
licenses
3
MIT
1
BSD-3-Clause
Package created
20 Dec 2015
Version published
8 Oct 2023
Maintainers
1
Total deps
4
Direct deps
3
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
3 Packages, Including:
dealerdirect/phpcodesniffer-composer-installer@v1.0.0
phpstan/phpdoc-parser@1.29.0
slevomat/coding-standard@8.14.1

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
squizlabs/php_codesniffer@3.9.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

3
All Dependencies CSV
β“˜ This is a list of slevomat/coding-standard 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
dealerdirect/phpcodesniffer-composer-installerv1.0.011.37 kBMIT
prod
phpstan/phpdoc-parser1.29.0-MIT
prod
squizlabs/php_codesniffer3.9.2-BSD-3-Clause
prod

Visualizations

Frequently Asked Questions

What does slevomat/coding-standard do?

Slevomat Coding Standard is a set of tools, also known as "sniffs," designed to enhance PHP_CodeSniffer. The Slevomat package checks PHP code for compliance with certain coding standards and best practices, which helps ensure code cleanliness, consistency, and safety. It offers functionality for not only enhancing code readability through format checks, but also improving its behavior and detecting dead code.

How do you use slevomat/coding-standard?

To use Slevomat Coding Standard, first, you have to add it to your project using Composer:

{
	"require-dev": {
		"slevomat/coding-standard": "~8.0"
	}
}

A typical way to use selected sniffs from the standard on your codebase is by writing your own ruleset.xml file, where you can reference only the sniffs you need:

<?xml version="1.0"?>
<ruleset name="AcmeProject">
	<config name="installed_paths" value="../../slevomat/coding-standard"/><!-- relative path from PHPCS source location -->
	<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
	<!-- other sniffs to include -->
</ruleset>

Then, run the phpcs executable:

vendor/bin/phpcs --standard=ruleset.xml --extensions=php --tab-width=4 -sp src tests

Some sniffs offer automatic fixing of errors. To use that feature, run phpcbf instead of phpcs:

vendor/bin/phpcbf --standard=ruleset.xml --extensions=php --tab-width=4 -sp src tests

Where are the slevomat/coding-standard docs?

The comprehensive documentation and guidelines for the slevomat/coding-standard package are conveniently included within the package itself. Specific guidance for each sniff can be found in the respective markdown files located within the doc directory mentioned in the README file. For example, array-related sniffs can be found in doc/arrays.md, class-related sniffs in doc/classes.md, and so on. A good understanding of these documents will help you effectively utilize this powerful coding standard tool.