PHPackages                             castlepointanime/brancher - 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. [Templating &amp; Views](/categories/templating)
4. /
5. castlepointanime/brancher

ActiveLibrary[Templating &amp; Views](/categories/templating)

castlepointanime/brancher
=========================

Lightweight static site generator using Twig

3122[4 issues](https://github.com/castlepointanime/brancher/issues)PHP

Since Sep 7Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (4)Used By (0)

Brancher: static site generator
===============================

[](#brancher-static-site-generator)

[![https://travis-ci.org/castlepointanime/brancher.svg?branch=master](https://camo.githubusercontent.com/ca542883635be6f447762cd1f5e6fd5a81cd7883e9c326ca501bd01f198b025c/68747470733a2f2f7472617669732d63692e6f72672f636173746c65706f696e74616e696d652f6272616e636865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/castlepointanime/brancher)[![https://insight.sensiolabs.com/projects/3ca2b791-6596-4f5d-bfd3-f4112748f82e/mini.png](https://camo.githubusercontent.com/f9ddc7e0aebf3a68d725e9302d9fecaaf914983681858b9eb51b3bcb63d93634/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f33636132623739312d363539362d346635642d626664332d6634313132373438663832652f6d696e692e706e67)](https://insight.sensiolabs.com/projects/3ca2b791-6596-4f5d-bfd3-f4112748f82e)Brancher is a generic static site generator, based on Symfony components and using the Twig templating language. It was designed to be easy to use, but extensible and usable for any type of site structure.

License
-------

[](#license)

Brancher is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

For this documentation:

Copyright (C) 2015 Tyler Romeo. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.

Code samples in this documentation are placed in the public domain, or under the [Creative Commons 0](https://creativecommons.org/publicdomain/zero/1.0/) license if needed by jurisdiction.

Why Brancher?
-------------

[](#why-brancher)

We created brancher because there were certain features we couldn't find in other static site generators:

- Storage of arbitrarily structured data (and the ability to iterate over it)
- Easy processing and filtering of JavaScript and CSS resources
- Addition custom PHP extensions to the build tool for site-specific functionality

Unlike other static site generators, this is not blog-focused. There is no flat "\_posts" directory that contains all of the dynamic content for the site. Instead this is meant for non-blog websites that sometimes contain multiple levels of structured data.

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

[](#requirements)

Brancher is PHP-based, so it needs a couple of things:

- [PHP](https://secure.php.net/) 5.4 or greater for command-line (usually available as the package `php5-cli`)
- [Composer](https://getcomposer.org/), a dependency management tool for PHP

That's it! All the libraries Brancher needs will be installed in the `vendor/` directory of your project using Composer. Check out the [Composer](https://getcomposer.org/) documentation for more details.

Installation and Use
--------------------

[](#installation-and-use)

Brancher can be installed and used with Composer:

```
# Install
composer init
composer require castlepointanime/brancher

# Use
./vendor/bin/brancher build
# => The current folder will be rendered into _site/
```

Directory Structure
-------------------

[](#directory-structure)

A typical Brancher project has a following typical directory structure (note that the location of each directory can be customized):

```
.
├── index.html
├── _config.yml
├── _templates
|   ├── base.twig.html
|   ├── layout.twig.html
|   ├── header.twig.html
|   └── footer.twig.html
├── _resources
|   ├── js
|   |   ├── my_library.js
|   |   ├── other_library.js
|   └── css
|       ├── base_style.css
|       ├── home_style.css
|       └── other_style.css
├── _data
|   ├── news
|   |   ├── 2015-08-10-post-of-some-sort.html
|   |   └── 2015-09-20-another-news-post.html
|   └── staff
|       ├── ceo.html
|       ├── cfo.html
|       └── software_engineer.html
└── _site
```

An overview of the purpose of each of the directories:

DirectoryCLI OptionDescription.``The root directory that contains the actual files for the site. Every file in the root will translated to a file of the same name in the rendered site. (Of course, if the templates, data, or other special directories are inside the root, they will be ignored for rendering.)\_config.yml`--config`The configuration file, which can be used to specify any of the command line options, as well as more advanced stuff, like installing extensions.\_templates`--template-dir`Contains Twig templates that can be `{% include %}` or `{% extend %}` into your site. Templates in this directory can, of course, refer to other templates as well.\_resources`--resource-dir`Contains JavaScript, CSS, and image resources. This directory only needs to be used if you plan on using [Assetic](https://github.com/kriswallsmith/assetic), which is built into Brancher, to process your resources.\_data`--data-dir`Contains arbitrary structured data for your site. In this case, the filesystem determines the structure of your data. Data directories can be iterated over in your site, and files can be read and parsed.\_site``The output directory where the final static HTML site is rendered into. (Warning: existing files that are not a part of the site will be erased.)Configuration File
------------------

[](#configuration-file)

As mentioned before, there is a `_config.yml` file, whose location can be customized, that can be used to specify build parameters. (Note: the config file is processed using Symfony, meaning it can be any file extension that the Symfony config component supports, specifically YAML, XML, PHP, and INI.)

Example Config file:

```
brancher:
    build:
        # The  directory
        root: src

        # The  directory
        output: _site

        # Any --template-dir directories
        templates:
        - templates

        # The --resource-dir directory
        resources: resources

        # Any --data-dir directories
        data:
        - data

        # Any directories to --exclude
        excludes:
        - vendor
```

Warning: Command line options will override whatever is in the configuration file. If an option is not specified on either the command line or config file, then the default mentioned above will be used.

Read More
---------

[](#read-more)

That's the basics! If you want to read more about a specific component of Brancher, visit any of the pages below:

- [Writing Pages and Templates](templates.rst): Introduction to using Twig templates with Brancher
- [Adding Site Data](data.rst): Using data in the `--data-dir` directories inside your site's pages
- [Using Assetic for Resources](resources.rst): Processing and versioning resources using Assetic
- [Built-in Extensions](built-in-extensions.rst): Usage for some built-in extensions that provide functionality in Brancher
- [Making or Installing Extension](extensions.rst): Making your own extensions and hooking into the build process

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/c3e5a4fdc8d27a743ef4a9da0a88a2c1b16e1fdf0099407515f44f241d4da05f?d=identicon)[Parent5446](/maintainers/Parent5446)

---

Top Contributors

[![Parent5446](https://avatars.githubusercontent.com/u/52883?v=4)](https://github.com/Parent5446 "Parent5446 (49 commits)")

### Embed Badge

![Health badge](/badges/castlepointanime-brancher/health.svg)

```
[![Health](https://phpackages.com/badges/castlepointanime-brancher/health.svg)](https://phpackages.com/packages/castlepointanime-brancher)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

555.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

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