Download the PHP package solidframe/phpstan-rules without Composer

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

SolidFrame PHPStan Rules

PHPStan rules for DDD, CQRS, and Event Sourcing architectural enforcement.

Static analysis catches architectural violations before tests even run.

Installation

The rules are auto-registered via PHPStan's extension mechanism. No manual configuration needed.

Rules

CQRS Rules

Command Handler Must Return Void

Command handlers perform side effects and must not return values.

Query Handler Must Not Return Void

Query handlers must return data.

Handler Must Be Invokable

Handlers must implement __invoke() and have only one public method (besides __construct).

Messages Must Be Final Readonly

Commands and Queries must be declared as final readonly.

Messages Must Not Extend

Commands and Queries must not extend other classes. Use composition.

DDD Rules

Value Object Must Be Readonly

Value objects are immutable. The class must be declared as readonly.

No Direct Aggregate Construction

Aggregate roots must be created via static factory methods, not new.

Construction inside the aggregate class itself is allowed.

Event Sourcing Rules

Events Must Be Final Readonly

Domain events are immutable data structures.

Apply Method Must Exist

For every event recorded via recordThat(), a corresponding apply{EventName}() method must exist.

Configuration

Rules work out of the box with SolidFrame interfaces. To use with custom interfaces, override in your phpstan.neon:

Rule Summary

Rule ID Area
Command handler returns void solidframe.commandHandlerMustReturnVoid CQRS
Query handler returns data solidframe.queryHandlerMustNotReturnVoid CQRS
Handler is invokable solidframe.handlerMustBeInvokable CQRS
Handler has single public method solidframe.handlerSinglePublicMethod CQRS
Command is final solidframe.commandMustBeFinal CQRS
Command is readonly solidframe.commandMustBeReadonly CQRS
Query is final solidframe.queryMustBeFinal CQRS
Query is readonly solidframe.queryMustBeReadonly CQRS
Message has no parent class solidframe.messageMustNotExtend CQRS
Value object is readonly solidframe.valueObjectMustBeReadonly DDD
No direct aggregate construction solidframe.noDirectAggregateConstruction DDD
Event is final solidframe.eventMustBeFinal Event Sourcing
Event is readonly solidframe.eventMustBeReadonly Event Sourcing
Apply method exists for recorded events solidframe.applyMethodMustExist Event Sourcing

Complementary: ArchTest vs PHPStan Rules

Concern ArchTest PHPStan Rules
Namespace dependencies doesNotDependOn()
Class structure (final, readonly) areFinal(), areReadonly() Message/VO/Event rules
Handler return types Command void, Query non-void
Handler conventions Invokable, single public method
Event apply methods applyMethodMustExist
Aggregate construction noDirectAggregateConstruction
Module isolation Modular preset

Use both for comprehensive architectural enforcement.

Related Packages

Contributing

This repository is a read-only split of the solidframe/solidframe monorepo, auto-synced on every push to main. Issues, pull requests, and discussions belong in the monorepo.


All versions of phpstan-rules with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 solidframe/phpstan-rules contains the following files

Loading the files please wait ...