Quick Start

Install StructArmed as a development dependency, initialize a preset, then run the analyser.

Contents

  1. Installation
  2. Initialize A Preset
  3. Analyse The Project
  4. Default Configuration
  5. Multiple Presets

Installation

composer require --dev boundwize/structarmed

Initialize A Preset

# Defaults to --preset=psr4
vendor/bin/structarmed init

# Verify source paths match composer.json PSR-4 mappings
vendor/bin/structarmed init --preset=psr4

# Enforce basic coding standard rules
vendor/bin/structarmed init --preset=psr1

# PSR-12 extends PSR-1 with explicit member visibility checks
vendor/bin/structarmed init --preset=psr12

# PSR-15 middleware and request handler interface checks
vendor/bin/structarmed init --preset=psr15

# Thin controllers, model/view/service layer rules
vendor/bin/structarmed init --preset=mvc

# Layer isolation and DDD naming conventions
vendor/bin/structarmed init --preset=ddd

# Enable every preset at once
vendor/bin/structarmed init --preset=all

The generated structarmed.php file lives in your project root.

Analyse The Project

vendor/bin/structarmed analyse

The American spelling is also supported:

vendor/bin/structarmed analyze

If violations are found, StructArmed reports each one:

StructArmed violation output

If everything passes, StructArmed prints a clean summary:

StructArmed clean analysis output

Default Configuration

<?php

// structarmed.php
use Boundwize\StructArmed\Architecture;
use Boundwize\StructArmed\Preset\Preset;

return Architecture::define()
    ->withPreset(Preset::PSR4());

Multiple Presets

->withPresets(
    Preset::PSR4(),
    Preset::PSR1(),
    Preset::PSR12(),
    Preset::PSR15(),
    Preset::MVC(),
    Preset::DDD(),
)