ok/uml-php

The library for generating information about project's classes

1.2 2022-08-30 12:26 UTC

This package is auto-updated.

Last update: 2024-09-29 05:55:26 UTC


README

uml-php is a library for crawling and generating data structors from project's classes. Information about classes based on doc comments and signature of classes, methods, properties and etc. Information about classes is represented by a number of nodes:

Install

composer require ok/uml-php --dev

Usage

Simple way to use it is create a some cli command

<?php

namespace Tests;

use OK\Uml\Uml;
use OK\Uml\Parser\Parser;
use OK\Uml\Serializer\JsonSerializer;

class Test {
    public function __construct() {
        require_once __DIR__ . '/vendor/autoload.php';
        $uml = new Uml('path_to_project', new Parser(), new JsonSerializer());
        
        echo $uml->get();
    }
}

$test = new Test();

run this using terminal and write output in file

$ php test.php >> file

The result file will contains a data about project's classes, serialized to JSON. You can write and use your own serializer if needed. If you will use default serializer you can interpret data via simple uml-viewer. But it is ugly right now.

If you want to get data as is array of php nodes, just use getRaw method in your code

$uml->getRaw();