This package is abandoned and no longer maintained. The author suggests using the structurizr-php/structurizr-php package instead.

Structurizr for PHP

0.3.0 2021-04-18 11:19 UTC


Minimum PHP Version Latest Stable Version Total Downloads License

This repository is a port of Structurizr for Java. All credits for creating C4 goes of course to Simon Brown this library is nothing more that simple port of the code that already exists in other language.

How to Use


composer require structurizr-php/structurizr-php

A quick example

As an example, the following PHP code can be used to create a software architecture model and an associated view that describes a user using a software system.


$workspace = new Workspace(
    $id = (string)\getenv('STRUCTURIZR_WORKSPACE_ID'),
    $name = 'Getting Started',
    $description = 'This is a model of my software system. by structurizr-php/structurizr-php'
$workspace->getModel()->setEnterprise(new Enterprise('Structurizr PHP'));
$person = $workspace->getModel()->addPerson(
    $name = 'User',
    $description = 'A user of my software system.',
$softwareSystem = $workspace->getModel()->addSoftwareSystem(
    $name = 'Software System',
    $description = 'My software system.',
$person->usesSoftwareSystem($softwareSystem, 'Uses', 'Http');

$contextView = $workspace->getViews()->createSystemContextView($softwareSystem, 'System Context', 'system01', 'An example of a System Context diagram.');

$styles = $workspace->getViews()->getConfiguration()->getStyles();


$client = new Client(
    new Credentials((string) \getenv('STRUCTURIZR_API_KEY'), (string) \getenv('STRUCTURIZR_API_SECRET')),
    new UrlMap(''),
    new Psr18Client(),
    new SymfonyRequestFactory(),
    new Logger('structurizr', [new StreamHandler('php://stdout')])

The view can then be exported to be visualised in a number of different ways; e.g. PlantUML, Structurizr and Graphviz:

Views can be exported and visualised in many ways; e.g. PlantUML, Structurizr and Graphviz

More Examples

Hire in Social

Hire in Social - project example

Structurizr Workspace

System Landscape

System Landscape System Landscape Key


Container Container Key

Big Bank Plc

System Landscape System Context Contianer Components Dynamic Development Deployment Live Deployment