Getting Started: Tools

Tools

The core tools are:

  • hh_client: this is the command line interface for Hack's static analysis; it is needed to verify that a project is valid Hack, and is used to find errors in your programs
  • hhvm: this is used to execute your Hack code, and can either be used for CLI (e.g. hhvm foo.hack) or as a server, and has extensive documentation

Editors and IDEs

You can use any plain-text editor to edit Hack files - however, enhanced integration with Hack is available for several editors.

We primarily recommend using Visual Studio Code with the VSCode-Hack extension; this provides standard IDE-like features such as syntax highlighting, go-to-definition, and in-line display of Hack errors.

For Vim users, vim-hack provides syntax highlighting and language detection, and the ALE project provides enhanced support for Hack.

hack-mode provides a major mode for Emacs users.

Dependency Management

Hack dependencies are currently managed using Composer, which must be executed with PHP. Composer can be thought of as an equivalent to npm or yarn.

Other Common Tools

  • hackfmt is a CLI code formatter included with HHVM and Hack, and is also used by the various editor and IDE integrations
  • HHAST is added provides code style linting, and the ability to automatically modify code to adapt to some changes in the language or libraries
  • hacktest and fbexpect are commonly used together for writing unit tests