PHP code example of byte-kitsune / mago-architecture-graph

1. Go to this page and download the library: Download byte-kitsune/mago-architecture-graph library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

byte-kitsune / mago-architecture-graph example snippets




use ByteKitsune\MagoArchitectureGraph\ArchitectureGraphExtension;
use Mago\Sdk\Worker;

$root = dirname(__DIR__);

use ByteKitsune\MagoSymfonyWiring\ServiceConfigLoader;

$map = (new ServiceConfigLoader($root, [
    'config/services.yaml',
    'config/services.dev.yaml',
]))->load();

$extension = ArchitectureGraphExtension::create(
    $root,
    $root . '/.mago/architecture-policy.json',
    $map->classBindings(),
    $map->incomplete === [],
    $map->serviceClassBindings(),
);
(new Worker($extension))->run();

$extension = ArchitectureGraphExtension::create(
    $root,
    $root . '/.mago/architecture-policy.json',
    serviceClassBindings: [
        'processor.safe' => App\Processor::class,
        'processor.danger' => App\Processor::class,
        'safe.port' => App\SafePort::class,
        'danger.port' => App\DangerPort::class,
    ],
    serviceConstructorBindings: [
        'processor.safe' => [0 => 'safe.port'],
        'processor.danger' => [0 => 'danger.port'],
    ],
);
toml
[extension-hosts.architecture]
command = ["php", ".mago/architecture-worker.php"]