PHPackages                             facebook/hack-codegen - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. facebook/hack-codegen

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

facebook/hack-codegen
=====================

Hack Codegen is a library for programmatically generating Hack code

v4.5.1(4y ago)347552.4k↑11%93[5 issues](https://github.com/hhvm/hack-codegen/issues)[2 PRs](https://github.com/hhvm/hack-codegen/pulls)7Hack

Since Aug 7Pushed 3y ago11 watchersCompare

[ Source](https://github.com/hhvm/hack-codegen)[ Packagist](https://packagist.org/packages/facebook/hack-codegen)[ RSS](/packages/facebook-hack-codegen/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (8)Versions (61)Used By (7)

Hack Codegen [![Build Status](https://camo.githubusercontent.com/1660bebd3f9bdf9538d33f5c9da988da3eae96bb4acd7e69868a4287c02dca7f/68747470733a2f2f7472617669732d63692e6f72672f6868766d2f6861636b2d636f646567656e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/hhvm/hack-codegen)
===============================================================================================================================================================================================================================================================================================

[](#hack-codegen-)

Hack Codegen is a library for easily generating Hack code and writing it into signed files that prevent undesired modifications. The idea behind writing code that writes code is to raise the level of abstraction and reduce coupling. You can use your own way of describing a problem and generate the corresponding code. E.g. see examples/dorm. In this example, we use a schema to describe the structure of the data, and we use Hack Codegen to write the matching code.

Examples
--------

[](#examples)

The DORM example shows how to use the different aspects of the code generation in a simplified real-life example. The included tests also exemplify the usage of the different components.

Requirements
------------

[](#requirements)

Hack Codegen requires:

- HHVM
- Composer

Installing Hack Codegen
-----------------------

[](#installing-hack-codegen)

This package can be installed via composer:

```
composer require facebook/hack-codegen
```

Usage
-----

[](#usage)

Include the autoload file generated by composer and you are ready to start using it. For example:

```
