Download the PHP package xefi/phpstan-xefi-rules without Composer

On this page you can find all versions of the php package xefi/phpstan-xefi-rules. 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 phpstan-xefi-rules

PHPStan Xefi Rules

CI state Packagist version

Some custom PHPStan extensions to improve the readability, maintainability and overall quality of your PHP code base.

Package based on PHPStan. You can find the source package here.

Supported PHP versions

PHP version This package version
8.x Latest

How to use it

1: First, you may use Composer to install this package as a development dependency into your project:

2: Then, create a phpstan.neon or phpstan.neon.dist file in the root of your application. It might look like this:

The most important part is the includes one, that enables the rules of this package.

For all available options, please take a look at the PHPStan documentation: https://phpstan.org/config-reference

3: Finally, you may start analyzing your code using the phpstan console command:

Rules

Banned Functions Rule

Identifier : xefi.bannedFunctions

Ensure banned functions like dd() are not called.

Boolean Property Naming Rule

Identifier : xefi.booleanPropertyNaming

Ensure that a Boolean is always named with an is at the beginning of its name, to clarify the condition it represents.

Max Line Per Class Rule

Identifier : xefi.maxLinePerClass

Guarantee that a class is no more than 200 lines long, to clearly separate roles between classes and encourage clarification.

Max Line Per Method Rule

Identifier : xefi.maxLinePerMethod

Guarantee that a method is no more than 40 lines long, to separate roles between classes and encourage specification.

No Basic Exception Rule

Identifier : xefi.noBasicException

Ensure that no base exceptions are thrown in order to make custom and specific exceptions everywhere for better maintainability.

No Delete Cascade Rule (Laravel)

Identifier : xefi.noCascadeDeleteLaravel

Prevents cascading deletions in SQL to avoid uncontrolled deletions.
This rule forces you to think about the need for a cascading deletion, and to handle such cases in your code if you need to, which also makes it possible to use the observers and events managed by the framework.

This rule only works for Laravel.
A Symfony rule is planned.

No Generic Word Rule

Identifier : xefi.noGenericWord

Prevent generic variable names such as array, string, str, result, res, data to encourage developers to use clear and detailed names such as users, filteredUsers, usersCount, cars, ...

No Laravel Observer Rule

Identifier : xefi.noLaravelObserver

Forbid the use of Observers in Laravel, as the behavior of observers is sometimes incomprehensible and uncontrollable.
This rule encourages the use of Events & Listeners, whose behavior is similar but much more explicit and stable.

No Try Catch Rule

Identifier : xefi.noTryCatch

Prevent try catch usage to ensure that the user uses PHP exceptions.
This makes the code more readable and errors are handled by the framework if there is one.


All versions of phpstan-xefi-rules with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
phpstan/phpstan Version ^2.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 xefi/phpstan-xefi-rules contains the following files

Loading the files please wait ...