Download the PHP package innis/coding-standards without Composer

On this page you can find all versions of the php package innis/coding-standards. 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 coding-standards

innis/coding-standards

CI

These rules encode the conventions of the Innis ecosystem. They are deliberately opinionated and almost certainly not to everyone's taste — that is by design. They are published for anyone extending the Innis libraries, or who simply wants to hold their own code to the same standards.

PHPStan rules that enforce the Innis coding conventions mechanically, inside the phpstan analyse run every package already has. Because they run on the real parse tree and PHPStan's reflection, aliases, grouped use, inline fully-qualified names, and non-standard formatting are all handled correctly.

Installation

Then include the extension in phpstan.neon.dist alongside the project's other includes:

This manual includes: entry is required unless the project has phpstan/extension-installer installed, in which case the rules are registered automatically and no includes: line is needed.

Requires PHP 8.4+ and PHPStan ~2.2.2. It runs at any PHPStan level; the rules are independent of the level setting.

What it enforces

Every rule reports with a stable innis.* identifier so it can be targeted in ignoreErrors. There is no separate "warning" tier in PHPStan — everything below is a reported error — but the smell rules (adapterSuffix, managerSuffix, serviceSuffix, tooManyParameters, primitiveAtBoundary, ukEnglish) are the ones you most often silence per case. Prefer a code-pinned // Deliberate: / ADR fence (see Deliberate departures) over a project-wide ignoreErrors for a genuine one-off exception.

Identifier What it flags
innis.strictTypes A file that declares a type but is missing declare(strict_types=1).
innis.noTraits Any trait (banned ecosystem-wide; share behaviour through an injected collaborator).
innis.cleanArchitecture A use import that violates inward-only layering — Domain→Domain only; Application→Application/Domain; Infrastructure→Infrastructure/Application/Domain; Presentation→any. Catches cross-package leaks too.
innis.layerPlacement A class filed under no layer segment that declares a contract carrying one (implements on a class or enum, extends on a class or interface). Unlayered code is exempt from the layering rule, and that exemption is for the composition root; being bound to a layered contract means the class is layered code and must be filed where the inward rule sees it. A class sitting outside the layers to avoid importing outward wants the dependency inverted, not the file moved. An anonymous class has no namespace of its own and is judged where it is declared, so an inline double in a test, one built inside a layered file, and one in an unnamespaced entry-point script are all silent.
innis.interfaceNaming An interface whose name does not end in Interface.
innis.collectionPlacement A *Collection class, or one extending TypedCollection, outside a Collection/ namespace.
innis.collectionFlat Sub-grouping under Collection/ by concept (Collection/Reference/…).
innis.valueObjectImmutable A concrete ValueObject/ class that is not final or not a readonly class. Property-level readonly (the sanctioned memory-zeroing exception) reports with a tip so a human confirms the reason. abstract sum-type bases and fenced classes are exempt.
innis.failureNotThrowable A *Failure (returned-outcome) type that is throwable — a fault uses the *Exception suffix.
innis.exceptionPlacement A throwable / *Exception class outside an Exception/ namespace.
innis.exceptionShape An exception class that is neither final (leaf) nor abstract (base).
innis.noDomainRepository Any type filed under a Domain\Repository namespace. A persistence store is a driven port the host supplies and can swap, so its interface belongs in Application/Port/ beside the clock and the HTTP client — there is no Domain/Repository.
innis.portPlacement An Application/Port/ interface whose implementation is an Application/Service/ class the package constructs itself — a mis-filed internal collaborator; its interface belongs in Application/Service/.
innis.domainPurity A Domain/ namespace that reaches for impurity directly: a built-in that reads the clock, uses randomness, performs I/O, reads the environment, writes output, pauses, spawns a process or opens a socket; a zero-argument DateTime/DateTimeImmutable; or a request/session/global superglobal. Push the effect behind a port.
innis.tryFromReturnsNullable / innis.tryFromDoesNotThrow / innis.fromIsTotal Named constructors follow PHP's from/tryFrom split. A tryFrom* parses untrusted input: it returns ?self (or a *Failure) and never throws, so a missed failure is an analyser error. A from* is total, trusted construction: it may throw to assert an invariant and does not return nullable — a nullable from* is a tryFrom* under the wrong name.
innis.overrideAttribute A method that implements an interface method or overrides a parent method without #[\Override].
innis.promoteConstructorProperties A ValueObject/, DTO/ or Entity/ constructor that declares a field and assigns a same-named parameter to it in the body, instead of promoting the property. Only a plain pass-through assignment is flagged.
innis.typedConstants A class, interface or enum constant declared without a type.
innis.collectionContract A concrete typed collection (a *Collection, or a leaf extending TypedCollection) that is not final or does not implement IteratorAggregate + Countable.
innis.errorSuffix A non-throwable class or enum named *Error — a returned outcome value uses the *Failure suffix (\Error is a Throwable). An enum can never be throwable, so an *Error enum is always caught.
innis.valueObjectAccessors A property hook on a ValueObject/, or asymmetric visibility (private(set)) on a ValueObject/ or Entity/ — keep a uniform getX() read surface.
innis.noEmojis An emoji anywhere in a source file (code, comment, or string).
innis.noSingleton A static property typed as its own class, or a static getInstance() accessor — a singleton/service locator; inject an interface instead.
innis.ukEnglish A US spelling in a declared identifier (type/method/property/parameter/constant/enum-case name); string values are left alone.
innis.collectionOverArray A public signature that passes an array of an element for which a typed collection exists — pass the <Element>Collection, not a generic array.
innis.primitiveAtBoundary A string/int parameter or property in Domain/Application whose name matches an existing value object — parse the primitive to that value object at the boundary and thread it through.
innis.equalsSelf An equality method (equals/isEqualTo/sameValueAs/…) on a value object or entity whose parameter is not typed self — a widened parameter lets a sibling type be compared.
innis.transformationReturnsSelf A transformation (with*/add*/remove*/map/filter/…) on an immutable value, entity, or collection that returns void/bool/never instead of a new instance.
innis.adapterSuffix / innis.managerSuffix / innis.serviceSuffix A catch-all *Adapter / *Manager / *Service class name — name the class for what it does.
innis.tooManyParameters A function, method or constructor with more than three parameters — decompose the unit rather than bundling arguments into a parameter object.

Deliberate departures

The rules that can have a legitimate exception honour the ecosystem's Chesterton's-Fence convention: a // Deliberate: … comment or an ADR-NNNN reference pinned at the code marks a justified departure and is skipped. The marker is read from the reported node's own comments (see ADR-0011), so it is scoped to exactly the unit it sits on — a fence on one method silences that method, not its siblings. Rules that also look at the enclosing class let a class-level fence cover its members; tooManyParameters is pinned to the method or function it flags, so a wide constructor is fenced on the constructor, not the class.

Layering, trait, naming (including errorSuffix and failureNotThrowable, which are not catch-all smells but the \Error-is-throwable split), portPlacement (ADR-0015), overrideAttribute, typedConstants, collectionContract, valueObjectAccessors, noEmojis and collectionOverArray are always enforced — a departure there is an immediate refactor, not a comment. Several rules also relax in test code: ukEnglish/noEmojis skip test files, overrideAttribute enforces only first-party contracts there (framework overrides like setUp are exempt), tooManyParameters exempts data-record constructors, and layerPlacement skips test namespaces — which covers an inline anonymous double, since it is judged where it is declared.

To silence a rule project-wide (rather than a single site), target its identifier:

Development


All versions of coding-standards with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
nikic/php-parser Version ^5.0
phpstan/phpstan Version ~2.2.6
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 innis/coding-standards contains the following files

Loading the files please wait ...