PHP extension for StarUML 2
JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
CodeGenUtils.js fix some jslint errors Dec 24, 2015
PHPCodeGenerator.js Update PHPCodeGenerator.js Jun 10, 2017
PHPPreferences.js fix some jslint errors Dec 24, 2015
README.md fix some jslint errors Dec 24, 2015
main.js fix some jslint errors Dec 24, 2015
package.json refractory Jun 8, 2017

README.md

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 (Type Hinting)
  • Return Type (PHP7)
  • PHPDoc
  • Append to file extension

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.