PHPackages                             hhvm/xhp-bootstrap - 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. hhvm/xhp-bootstrap

AbandonedArchivedLibrary

hhvm/xhp-bootstrap
==================

Use Bootstrap with XHP

v1.0.2(9y ago)1001.8k25[3 issues](https://github.com/hhvm/xhp-bootstrap/issues)BSD-3-ClauseHack

Since Jan 29Pushed 9y ago31 watchersCompare

[ Source](https://github.com/hhvm/xhp-bootstrap)[ Packagist](https://packagist.org/packages/hhvm/xhp-bootstrap)[ Docs](https://github.com/hhvm/xhp-bootstrap)[ RSS](/packages/hhvm-xhp-bootstrap/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (7)Used By (0)

XHP classes for the Bootstrap project
=====================================

[](#xhp-classes-for-the-bootstrap-project)

Project Status
--------------

[](#project-status)

We are not planning to actively maintain this project; however, we still believe it has value as an example.

XHP-Bootstrap was one of the first general-purpose UI libraries for XHP; feedback from our users has shown several problems that ultimately make us believe that general-purpose UI libraries are not a good fit for XHP:

- Sites/applications should use semantic markup; Bootstrap should be an implementation detail, not something that every endpoint/controller is strongly tied to
- Strict child validation is a valuable part of XHP; it's not possible to do take advantage of this in a general-purpose library. This can be partially worked around through heavy usage of categories, however that significantly weakens XHP's model
- A similar problem exists for attributes, however there is no workaround; for example, many elements have an `href` attribute, which should take a `string` in a general purpose library - many sites will want to ban string hrefs, requiring a site-specific `URI` object instead. The only way to support this would be to type all attributes as `mixed`

We believe this project is still useful for reference when implementing your own elements. You may also find [the HHVM documentation site's XHP elements](https://github.com/hhvm/user-documentation/tree/master/src/site/xhp) useful as a real-world example.

Overview
--------

[](#overview)

The [Bootstrap](http://getbootstrap.com) project is a popular HTML, CSS, and JS framework providing common components for web pages. This project provides XHP classes for these components.

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

[](#requirements)

- [HHVM](http://hhvm.com/) 3.6 or later
- [Composer](https://getcomposer.org/)

Getting Started
---------------

[](#getting-started)

#### Step 1: Include Bootstrap Prerequisites

[](#step-1-include-bootstrap-prerequisites)

Bootstrap's JavaScript components require [jQuery](http://jquery.com/download/) to be included, so either grab the [downloadable version](http://jquery.com/download/) and reference it, or [use a CDN](http://jquery.com/download/#using-jquery-with-a-cdn) and include it in the head of your XHP document:

```

  ...

  ...

```

#### Step 2: Include Bootstrap Source

[](#step-2-include-bootstrap-source)

Grab the latest [Bootstrap package](http://getbootstrap.com/getting-started/#download) and reference it, or use their [CDN links](http://getbootstrap.com/getting-started/#download) and include them in the head of your XHP document:

```

  ...

  ...

```

#### Step 3: Add XHP-bootstrap dependency

[](#step-3-add-xhp-bootstrap-dependency)

Add the following to your composer.json, then re-run composer:

```
  "minimum-stability": "dev",
  "require": {
    "hhvm/xhp-bootstrap": "dev-master"
  }

```

#### Step 4: Enable Composer Autoloading

[](#step-4-enable-composer-autoloading)

If you haven't already, include the following in your PHP to enable [autoloading from Composer](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```
  require_once('vendor/autoload.php');

```

Once you've done this you are ready to start using [any of the XHP-Bootstrap classes](http://bootstrap.hhvm.com) in your project.

Class References and Examples
-----------------------------

[](#class-references-and-examples)

You can also browse the list of available XHP-Bootstrap classes with live examples at

You can also interact with these by configuring a webserver to look inside the `example/` directory and accessing `example.php`.

Differences
-----------

[](#differences)

In the Bootstrap documentation, a component's default/primary/success/info/warning/danger/link state (white/dark blue/green/light blue/orange/red/link) is referred to as `use` for some components, but `color` for others. XHP-Bootstrap uses the `use` attribute throughout for consistency.

License
-------

[](#license)

XHP-Bootstrap is BSD-licensed. We also provide an additional patent grant.

Contributing
------------

[](#contributing)

Please see CONTRIBUTING.md

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community25

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 74.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~168 days

Total

5

Last Release

3450d ago

Major Versions

v0.1 → v1.0.0rc12015-04-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/66d33e29918fd8cc713997dbbe03cb86e2aefbdc6736637641cdffed2f22accb?d=identicon)[fredemmott](/maintainers/fredemmott)

---

Top Contributors

[![fredemmott](https://avatars.githubusercontent.com/u/360927?v=4)](https://github.com/fredemmott "fredemmott (105 commits)")[![ckwalsh](https://avatars.githubusercontent.com/u/68822?v=4)](https://github.com/ckwalsh "ckwalsh (9 commits)")[![ptarjan](https://avatars.githubusercontent.com/u/40143?v=4)](https://github.com/ptarjan "ptarjan (9 commits)")[![andrekiu](https://avatars.githubusercontent.com/u/31644397?v=4)](https://github.com/andrekiu "andrekiu (4 commits)")[![sgolemon](https://avatars.githubusercontent.com/u/812538?v=4)](https://github.com/sgolemon "sgolemon (4 commits)")[![fpacifici](https://avatars.githubusercontent.com/u/1626430?v=4)](https://github.com/fpacifici "fpacifici (3 commits)")[![Swahvay](https://avatars.githubusercontent.com/u/974639?v=4)](https://github.com/Swahvay "Swahvay (3 commits)")[![rob0rt](https://avatars.githubusercontent.com/u/3067060?v=4)](https://github.com/rob0rt "rob0rt (2 commits)")[![RdeWilde](https://avatars.githubusercontent.com/u/184016?v=4)](https://github.com/RdeWilde "RdeWilde (1 commits)")[![matthewjohnston4](https://avatars.githubusercontent.com/u/986185?v=4)](https://github.com/matthewjohnston4 "matthewjohnston4 (1 commits)")

---

Tags

bootstraphacklangxhpfacebookhhvmbootstraphackxhp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hhvm-xhp-bootstrap/health.svg)

```
[![Health](https://phpackages.com/badges/hhvm-xhp-bootstrap/health.svg)](https://phpackages.com/packages/hhvm-xhp-bootstrap)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
