Skip to content

Instantly share code, notes, and snippets.

@greenwellness
Last active August 29, 2015 14:03
Show Gist options
  • Save greenwellness/d2151c370c2ed1af893b to your computer and use it in GitHub Desktop.
Save greenwellness/d2151c370c2ed1af893b to your computer and use it in GitHub Desktop.
Magento external support utilities I run in my Arch VM so most if not all are obtainable through core/AUR packages.

Utilities

The following excerpt contains the fluid, moderated and opinionated list of some of my preferred tools used in conjunction with Clojure or which greatly increase either productivity, offers key insight and often (related) faster debugging, easier deployment, less errors (many linters can be found here) and so on.

As the entire playing field of what is commonly known as the 'Magento framework' (or system) encompasses a great deal of interwoven components and technologies, when we take a most top-level view of matters, we distinguish these major forms

Magento core components
  • PHP (unique) own implementation of the MVC pattern of software design — Models as code representatives/agents of data; used throughout core code and which touches the edges of the Object Relational Model interoperability tasked objects

PHP Plantuml Writer

A tool to create PlantUML class diagrams from your PHP source. > Source: https://github.com/davidfuhr/php-plantumlwriter

Options

Help function for php-plantumlwriter command
Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v|vv|vvv Increase the verbosity of messages:
                      1 for normal output, 2 for more verbose output and 3 for debug
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.

Available commands:
  help    Displays help for a command
  list    Lists commands
  write   Generates PlantUML diagram from php source

Usage

Basic usage examples
Example 1. This first example demonstrates the most succinct form in which this program can be used. It Output Graphviz DOT language generated script (to the vte stdout interface = print to console window)

php-plantumlwriter write .

Example 2. Redirect stdout stream of generated .dot script to file (after having analyzed source in local code pool)
php-plantumlwriter write app/code/local > local-code.dot
Advanced (combined) usage

As always in any *nix system, the additional power of the system becomes apparent once you’ve witnessed the multitude of ways you can combine command in- and output.

Example 3. As mentioned elsewhere, a requirement for this tool would be the additional Jar plantuml.jar. This is not required per-se but without it, the Plantuml script generated can not be translated to other document formats like say HTML, SVG, XML or PNG. In this example with are taking names, since no less than the Mage core domain gets mapped to class diagram and saved as image file. Plantuml options might be listed elsewhere, as they are extensive in number, suffices to mention the -p switch will open the command for input to receive on stdin while simultaneously outputting binary image data in the PNG (and related) format by default.

php-plantumlwriter write app/code/core/Mage | plantuml -p > magento-core-domain.png

Requirements
  1. Executable Java archive plantuml.jar http://plantuml.sourceforge.net/download.html or via package manager (pkgman)

  2. PHP Composer for some dependencies obtained at http://getcomposer.org/ or via pkgman

  3. Graphviz graphical visualization library, home of the Dot graph scripting language (via pkgman)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment