PHPackages                             petersuhm/thin - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. petersuhm/thin

ActiveLibrary[File &amp; Storage](/categories/file-storage)

petersuhm/thin
==============

Flat file content management package for PHP.

015[2 issues](https://github.com/petersuhm/thin/issues)PHP

Since Mar 25Pushed 12y ago1 watchersCompare

[ Source](https://github.com/petersuhm/thin)[ Packagist](https://packagist.org/packages/petersuhm/thin)[ RSS](/packages/petersuhm-thin/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Thin - Flat file content management
===================================

[](#thin---flat-file-content-management)

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

Installation
------------

[](#installation)

Install Thin from [Packagist](https://packagist.org/packages/petersuhm/thin):

```
"petersuhm/thin": "dev-master"

```

Usage
-----

[](#usage)

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;

$postLoader->config(array(
    'document_path' = '../posts',
    'document_ext' = '.md'
));

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

// You can limit the number of documents
$posts->limit(5);

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

foreach ($posts as $post)
{
    $post->getMetadata('title');
    $post->getContent();
    $post->getHtmlContent();

    // Metadata can be accessed dynamically as well:
    $post->title;

    // 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.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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://avatars.githubusercontent.com/u/1430546?v=4)[Peter Suhm](/maintainers/petersuhm)[@petersuhm](https://github.com/petersuhm)

---

Top Contributors

[![petersuhm](https://avatars.githubusercontent.com/u/1430546?v=4)](https://github.com/petersuhm "petersuhm (37 commits)")

### Embed Badge

![Health badge](/badges/petersuhm-thin/health.svg)

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

###  Alternatives

[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

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