Skip to content

Yomyer/PHPCodeGenerator

Repository files navigation

<<<<<<< HEAD PHP Extension for StarUML 2

This extension for StarUML(http://staruml.io) support to generate PHP code from UML model. Install this extension from Extension Manager of StarUML.

PHP Code Generation

  1. Click the menu (Tools > PHP > Generate Code...)
  2. Select a base model (or package) that will be generated to PHP.
  3. Select a folder where generated PHP source files will be placed.

Configurations optionals

  • Strict Mode (PHP7)
  • PHPDoc
  • Append to file extencion

Features

Belows are the rules to convert from UML model elements to PHP source codes.

UMLPackage

  • converted to PHP Package (as a folder).
  • create namespaces

UMLClass

  • converted to PHP Class. (as a optional separate .class.php file)
  • isAbstract property to abstract modifier.
  • isFinalSpecification and isLeaf property to final modifier.
  • Default constructor is generated.
  • All contained types (UMLClass, UMLInterface) are generated as inner type definition.
  • Documentation property to PHPDoc comment.

UMLAttribute

  • converted to PHP Field.
  • visibility property to one of modifiers public, protected, private and none.
  • name property to field identifier.
  • type property to field type.
  • multiplicity property to array type.
  • isStatic property to static modifier.
  • isLeaf property to final modifier.
  • defaultValue property to initial value.
  • Documentation property to PHPDoc comment.

UMLOperation

  • converted to PHP Methods.
  • visibility property to one of modifiers public, protected, private and none.
  • name property to method identifier.
  • isAbstract property to abstract modifier.
  • isStatic property to static modifier.
  • UMLParameter to PHP Method Parameters.
  • UMLParameter's name property to parameter identifier.
  • UMLParameter's type property to type of parameter.
  • UMLParameter with direction = return to return type of method. When no return parameter, void is used.
  • UMLParameter with isReadOnly = true to final modifier of parameter.
  • Documentation property to PHPDoc comment.

UMLInterface

  • converted to PHP Interface. (as a separate .interface.php file)
  • visibility property to one of modifiers public, protected, private and none.
  • Documentation property to PHPDoc comment.

UMLAssociationEnd

  • converted to PHP Field.
  • visibility property to one of modifiers public, protected, private and none.
  • name property to field identifier.
  • type property to field type.
  • If multiplicity is one of 0..*, 1..*, *, then collection type (Array) is used.
  • defaultValue property to initial value.
  • Documentation property to PHPDoc comment.

UMLGeneralization

  • converted to PHP Extends (extends).
  • Allowed only for UMLClass to UMLClass, and UMLInterface to UMLInterface.

UMLInterfaceRealization

  • converted to PHP Implements (implements).
  • Allowed only for UMLClass to UMLInterface. =======

PHPCodeGenerator

PHPCodeGenerator Plugin For StarUML

59809a4989732790ec6d7bbcd05761ad937bf278

About

PHPCodeGenerator Plugin For StarUML

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published