Download the PHP package happenv-com/laravel-true-modular-phpstan without Composer

On this page you can find all versions of the php package happenv-com/laravel-true-modular-phpstan. 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 laravel-true-modular-phpstan

PHPStan for Laravel True Modular

PHPStan for Laravel True Modular

Latest Version on Packagist Total Downloads Tests PHPStan Zizmor Code Style

PHPStan extensions for laravel-true-modular modular monoliths. Ships two independent, zero-config extensions:

Extension What it does
Dynamic Relation Resolver Teaches PHPStan about Eloquent relations registered at runtime via Model::resolveRelationUsing() (e.g. relations one module adds to another module's model). Such relations are normally invisible to static analysis — this extension makes $model->relation and $model->relation() fully typed.
Module Boundary Enforcer Fails analysis when a module references a class from another module that is not declared in its composer.json require. Also detects circular dependencies between modules.

Requires PHP 8.3+, PHPStan 2.x and laravel-true-modular (Laravel 12/13). It reuses the framework's own module discovery, so it understands your modules out of the box — no PHPStan parameters to set.

Installation

The package is a phpstan-extension. If you use phpstan/extension-installer (recommended), both extensions are registered automatically — nothing else to do:

Make sure the plugin is allowed in your root composer.json:

Manual registration (without extension-installer)

Include the bundled config in your phpstan.neon:

Or cherry-pick a single extension:

Larastan recommended. The Dynamic Relation Resolver reflects your Eloquent models, so install larastan/larastan for accurate results. With extension-installer it is wired up automatically.

Zero configuration

Neither extension needs any parameters in phpstan.neon. The Module Boundary Enforcer discovers modules through laravel-true-modular's own ModuleRegistry, which means it automatically honours:

A "module" is any package under that directory whose composer.json declares the module type. Allowed cross-module dependencies are read straight from each module's composer.json require section — exactly the same source of truth the framework uses to order service providers at runtime. There is no vendor prefix or path to configure.

If no modules are found (e.g. the directory does not exist), both rules silently do nothing, so installing the package never breaks an unrelated build.

What it reports

Dynamic Relation Resolver

Once installed it automatically types any relation registered through Laravel's relation resolver, for example:

To-one relations (hasOne, belongsTo, morphOne, hasOneThrough) are typed as Related|null; to-many relations as Collection<int, Related>.

Module Boundary Enforcer

For every module the enforcer reads its composer.json and treats its require entries that resolve to other known modules as the allowed cross-module dependencies. A module may always reference its own classes and any class from a package that is not a module (vendor libraries, the host application, …).

Violations look like:

Both use statements and inline references (new, static calls, instanceof, extends/implements, catch, class constants) are checked.

Circular dependencies are reported once at the end of analysis:

Error identifiers

You can ignore findings by identifier in phpstan.neon:

Identifier Meaning
trueModular.moduleBoundary Disallowed cross-module reference
trueModular.circularDependency Cycle between modules

Example phpstan.neon

That's the whole configuration — point PHPStan at your modules and run it.

Development

The test suite covers both extensions:

License

MIT


All versions of laravel-true-modular-phpstan with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
happenv-com/laravel-true-modular Version ^1.0
illuminate/database Version ^12.0 || ^13.0
phpstan/phpstan Version ^2.0
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 happenv-com/laravel-true-modular-phpstan contains the following files

Loading the files please wait ...