Flat file content management package for PHP.

Installs: 10

Dependents: 0

Watchers: 1

Forks: 1

Open Issues: 2

Language: PHP

dev-master 2014-03-25 19:00 UTC


Thin is a package for flat file content management. By default, it supports files in Markdown and Markdown Extra format.


Install Thin from Packagist:

"petersuhm/thin": "dev-master"


You can make your own implementations, depending on your type of content and which parser you want to use (it's Markdown by default). By default, Thin comes with two parsers, one for Markdown and one for Markdown Extra, and one model to handle blog posts.

$postLoader = new \Thin\PostLoader;

    'document_path' = '../posts',
    'document_ext' = '.md'

// Returns a DocumentCollection
$posts = $postLoader->all();

// You can limit the number of documents

// You can also order documents by metadata
$posts->orderBy('date', 'desc');
$posts->orderBy('date', 'desc')->limit(3);

foreach ($posts as $post)

    // Metadata can be accessed dynamically as well:

    // Optionally give an instance of ParserInterface as a parameter
    $post->getHtmlContent(new \Thin\Parsers\MarkdownExtraParser);


// The PostLoader uses a slug as identifier
$post = $postLoader->find('some-slug');

The PostLoader expects files to follow the following convention:

    "some_metadata": "In JSON format",
    "...": "..."

The content of the document.

If your files have a different format, you can write your own loader.