PHPackages                             slogsdon/flat-file - 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. slogsdon/flat-file

ActiveLibrary

slogsdon/flat-file
==================

Fast static-site generator / flat-file CMS

1.0.3(7y ago)5111MITPHPPHP ~7.1

Since Jul 22Pushed 1y ago2 watchersCompare

[ Source](https://github.com/slogsdon/php-flat-file)[ Packagist](https://packagist.org/packages/slogsdon/flat-file)[ RSS](/packages/slogsdon-flat-file/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (7)Used By (0)

flat-file
=========

[](#flat-file)

[![Latest Stable Version](https://camo.githubusercontent.com/342d867c87fd37f50717de367e601f334e6bc3cf29f5305bebb068f693d94610/68747470733a2f2f706f7365722e707567782e6f72672f736c6f6773646f6e2f666c61742d66696c652f762f737461626c65)](https://packagist.org/packages/slogsdon/flat-file)[![Total Downloads](https://camo.githubusercontent.com/f5e540abfbe0cc8077090716ec0473dce33da9661c986593adaf2ce7a56b57ee/68747470733a2f2f706f7365722e707567782e6f72672f736c6f6773646f6e2f666c61742d66696c652f646f776e6c6f616473)](https://packagist.org/packages/slogsdon/flat-file)[![Latest Unstable Version](https://camo.githubusercontent.com/186f81840503e90dd3ce31c6cdb8663f024f0ade3d9b55c56d2d273479efd942/68747470733a2f2f706f7365722e707567782e6f72672f736c6f6773646f6e2f666c61742d66696c652f762f756e737461626c65)](https://packagist.org/packages/slogsdon/flat-file)[![License](https://camo.githubusercontent.com/18896c1835bde898922641afbc39c537978b04a1ae7e1d5206c0b0a6a3aa4e40/68747470733a2f2f706f7365722e707567782e6f72672f736c6f6773646f6e2f666c61742d66696c652f6c6963656e7365)](https://packagist.org/packages/slogsdon/flat-file)[![Build Status](https://camo.githubusercontent.com/bfafadce1503fe91077e30dcc8769901f93ddbc3a51b8c4e96e5f50f51b9c647/68747470733a2f2f7472617669732d63692e636f6d2f736c6f6773646f6e2f7068702d666c61742d66696c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/slogsdon/php-flat-file)[![Maintainability](https://camo.githubusercontent.com/cef784ab018e71852107b3e5c31856f052433aa4fc50c16559ea063874280ce6/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39353335343935333765363530356664643833642f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/slogsdon/php-flat-file/maintainability)[![Test Coverage](https://camo.githubusercontent.com/0fc4ce1f5414ebee85eec55c41123f81d680d2a533a52b20dc25b9468c63085b/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f39353335343935333765363530356664643833642f746573745f636f766572616765)](https://codeclimate.com/github/slogsdon/php-flat-file/test_coverage)

> Fast static-site generator / flat-file CMS

[View an example project.](https://github.com/slogsdon/php-flat-file-starter)

### Features

[](#features)

- Needs zero configuration
- Uses Markdown, HTML, or PHP
- Routes based on file system
- Exports static sites, or runs via PHP powered web servers
- Includes development environment

### Reasoning

[](#reasoning)

PHP is easy to install, if not already present on you computer. PHP runs pretty much everywhere. PHP is flexible.

This project also scratches an itch to see how much PHP can handle in this problem domain.

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

[](#requirements)

- [PHP 7.1+](http://www.php.net/)
- [Composer](https://getcomposer.org/)

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

[](#getting-started)

```
{
    "name": "user/site",
    "description": "",
    "require": {
        "slogsdon/flat-file": "dev-master"
    },
    "scripts": {
        "build": "flat-file build",
        "start": "flat-file serve"
    },
    "config": {
      "process-timeout": 0
    }
}
```

The `scripts` and `config` sections are not required, but they do help simplify the development process. If using the `start` script, the `process-timeout` configuration option allows Composer to run a script for longer than the default timeout (300 seconds).

If not using Composer script configurations, you'll need to reference the `flat-file` script as `vendor/bin/flat-file`, e.g.:

```
vendor/bin/flat-file build
vendor/bin/flat-file serve

```

After setting up your `composer.json` file, don't forget to pull down your dependencies:

```
composer install

```

### Adding Content

[](#adding-content)

Next, your individual pages need to be included in a `pages` directory at the root of your project (i.e. next to your `composer.json` file). Pages can be written in Markdown (with the `.md` or `.markdown` file extension), plain HTML, or PHP (with the `.php` file extension). PHP files have the option of outputing the content as normal (echo, print, content outside of `` tags, etc.) or returning the content as a string (`
