DEV.co
Open-Source Testing · phparkitect

arkitect

PHPArkitect is a PHP testing framework that lets developers write architectural rules as code and verify them in CI/CD pipelines. It prevents architectural violations (e.g., domain layers depending on infrastructure) by running checks alongside your test suite.

Source: GitHub — github.com/phparkitect/arkitect
922
GitHub stars
52
Forks
PHP
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryphparkitect/arkitect
Ownerphparkitect
Primary languagePHP
LicenseMIT — OSI-approved
Stars922
Forks52
Open issues38
Latest release1.2.0 (2026-07-02)
Last updated2026-07-04
Sourcehttps://github.com/phparkitect/arkitect

What arkitect is

PHPArkitect parses PHP source code to extract class dependencies, namespaces, and metadata, then evaluates user-defined rules (selectors + conditions + assertions) expressed as fluent PHP objects. It supports multiple output formats (text, JSON, GitLab) and integrates with CI/CD via CLI with baseline support for gradual enforcement.

Quickstart

Get the arkitect source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/phparkitect/arkitect.gitcd arkitect# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Enforcing Layered Architecture

Prevent domain/business logic layers from importing infrastructure (database, HTTP, file I/O) dependencies, catching coupling violations early in the development cycle.

Scaling Codebases with Naming Conventions

Maintain consistency across growing teams by enforcing naming patterns (e.g., all controllers must match *Controller, repositories must implement RepositoryInterface).

Gradual Architectural Refactoring

Document existing violations in a baseline file, then incrementally fix them while preventing new violations—ideal for legacy codebases transitioning to DDD or modular architectures.

Implementation considerations

  • Config file (phparkitect.php) must be maintained as codebase evolves; rule complexity grows with architecture maturity—start simple and add rules incrementally.
  • Parser targets specific PHP versions (8.0–8.5); ensure target version matches your runtime to avoid attribute/syntax mismatches.
  • Baseline files (phparkitect-baseline.json) require careful version control; line number sensitivity can cause false failures if baseline tracking is disabled.
  • Custom annotation parsing is enabled by default; disable it if your project uses Doctrine, Symfony, or other annotation-heavy frameworks to reduce parse time.
  • Integration with existing test suites is seamless (Composer dev dependency), but requires deliberate CI/CD step to fail builds on violations.

When to avoid it — and what to weigh

  • Non-PHP Codebases — PHPArkitect is PHP-only; projects using other languages (Python, Node.js, Java) need dedicated architecture testing tools.
  • Real-Time Runtime Enforcement Needed — PHPArkitect is a static analysis tool run at build/test time. It cannot enforce architecture at runtime or prevent instantiation of violating classes dynamically.
  • Dynamic or Eval-Based Code — Projects heavily reliant on reflection, dynamic class loading, or eval() may have unparseable dependencies that PHPArkitect cannot reliably detect.
  • No CI/CD Pipeline — Without automated testing infrastructure, adoption requires manual discipline to run checks locally, reducing effectiveness as a safety net.

License & commercial use

MIT License (OSI-compliant, permissive). Permits commercial use, modification, and distribution with minimal restrictions (attribution required).

MIT is a permissive, OSI-approved license. Commercial use is explicitly permitted. No warranty or liability guarantees; typical for open-source tooling. Review your organization's legal stance on MIT-licensed dev dependencies if required by policy.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

PHPArkitect is a static analysis tool; it does not execute user code or make network calls. Security posture depends on: (1) integrity of parsed PHP files (PHPArkitect does not validate them), (2) Composer supply chain (transitive dependencies), (3) baseline file tampering (could hide violations if not version-controlled). No known CVEs stated in data. Parsing custom annotations is enabled by default—consider disabling if parsing untrusted annotation syntax.

Alternatives to consider

Deptrac

Mature static analysis tool for PHP dependency graphs; more flexible layer and rule definitions; larger community. More complex setup; less integrated with modern PHP tooling.

PhpStan with custom rules

General-purpose static analyzer with extension API; broader scope (type checking + architecture). Steeper learning curve for custom rule development; less specialized for architecture.

SonarQube

Enterprise-grade code quality platform supporting multiple languages and detailed architecture analysis. Significant operational overhead; cloud/self-hosted; not lightweight.

Software development agency

Build on arkitect with DEV.co software developers

PHPArkitect makes it easy to define and validate architectural rules alongside your test suite. Start with a simple rule, integrate into CI/CD, and catch violations early.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

arkitect FAQ

Does PHPArkitect prevent violations at runtime?
No. It is a static analysis tool run at build/test time. Violations are caught in CI/CD, not during code execution. Use DI containers or interfaces to enforce architecture at runtime.
Can I use PHPArkitect with legacy codebases?
Yes. Generate a baseline file (--generate-baseline) to snapshot current violations, then enforce new rules going forward. Gradually fix violations and remove them from baseline.
What PHP versions are supported?
PHPArkitect targets PHP 8.0–8.5 for parsing. The tool itself requires PHP 8.0+. Use --target-php-version to specify your codebase's version if different from runtime.
Does PHPArkitect slow down CI/CD?
Minimal overhead. Parsing is fast for typical codebases (hundreds of classes). Exact performance depends on codebase size and number of rules. No benchmarks provided in documentation.

Software developers & web developers for hire

DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If arkitect is part of your open-source testing roadmap, our team can implement, customize, migrate, and maintain it.

Enforce architecture as code in your PHP projects

PHPArkitect makes it easy to define and validate architectural rules alongside your test suite. Start with a simple rule, integrate into CI/CD, and catch violations early.