PHPackages                             sly/bloghub - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sly/bloghub

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sly/bloghub
===========

Use a Git repository to generate blog entities and contents. PlainText, HTML and Markdown formats supported.

36PHP

Since Jan 6Pushed 13y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

BlogHub
=======

[](#bloghub)

Use a Git repository to generate blog entities and contents.

=====

WORK IN PROGRESS.
-----------------

[](#work-in-progress)

=====

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

[](#requirements)

- PHP 5.3+

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

[](#installation)

### Add to your project Composer packages

[](#add-to-your-project-composer-packages)

Just add `sly/blog-hub` package to the requirements of your Composer JSON configuration file, and run `php composer.phar install` to install it.

### Install from GitHub

[](#install-from-github)

Clone this library from Git with `git clone https://github.com/Ph3nol/BlogHub.git`.

Goto to the library directory, get Composer phar package and install vendors:

```
curl -s https://getcomposer.org/installer | php
php composer.phar install

```

You're ready to go.

Repository structure
--------------------

[](#repository-structure)

Your git repository has to respect a Categories/Posts structure to be understood by the library.

The logic:

```
Category 1
   `-- Title of my post 1
   `-- Title of my post 2
   `-- Title of my post 3

Category 2
   `-- Title of my post 4

```

To match this logic, the repository tree will be:

```
Category 1/
Category 1/Title of my post 1.md
Category 1/Title of my post 2.md
Category 1/Title of my post 3.md
Category 2/
Category 2/Title of my post 4.md

```

Post structure
--------------

[](#post-structure)

Each post has to be a markdown file, into a category folder. Informations can be added to it as PHPDoc/Annotations one. Here is an example:

```
/**
 * @createdAt 2013-01-01
 * @description This is my post description.
 * @tags tag1, tag2, tag3
 * @format markdown
 */

# My post title

My post content.

```

Example
-------

[](#example)

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

use GitElephant\Repository;
use Sly\BlogHub\Blog\Blog;

/**
 * GitElephant repository instance.
 */
$repo = new Repository('/path/to/your/repository');
$repo->checkout('master');

/**
 * BlogHub instance, with repository object as argument.
 */
$blog = new Blog($repo);
```

### Categories list

[](#categories-list)

```
foreach ($blog->getCategories() as $category) {
    // Your logic
}
```

**Elements:**

- Category name: `(string) $category` or `$category->getName()`
- Posts collection: `$category->getPosts()`
- Number of posts: `$category->getPosts()->count()`

### Posts list

[](#posts-list)

```
foreach ($blog->getPosts() as $post) {
    // Your logic
}
```

```
foreach ($category->getPosts() as $post) {
    // Your logic
}
```

**Elements:**

- Post title: `(string) $post` or `$post->getTitle()`
- Post category object: `$post->getCategory()`
- Slug: `$post->getSlug()`
- Excerpt: `$post->getExcerpt([string $separator = ' [...]'])`
- Tags collection: `$post->getTags()`
- Creation DateTime: `$post->getCreatedAt()`
- Update DateTime: `$post->getUpdatedAt()`

### Tags list

[](#tags-list)

```
foreach ($blog->getTags() as $tag) {
    // Your logic
}
```

```
foreach ($post->getTags() as $tag) {
    // Your logic
}
```

**Elements:**

- Tag name: `(string) $tag` or `$tag->getName()`

Query Builder
-------------

[](#query-builder)

You can use the QueryBuilder to retreive a specific model entity. Here is an example:

```
$query = $blog->getQuery(); // Get QueryBuilder from Blog Manager service
$post  = $query->from('Post')->getOneBySlug('hello-world'); // Get the Post from its slug
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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/79ab5d3acf23a0168a1fcb922906c451579d4ab3143f6c0bc5244deb69d83073?d=identicon)[Ph3nol](/maintainers/Ph3nol)

### Embed Badge

![Health badge](/badges/sly-bloghub/health.svg)

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

###  Alternatives

[bgaze/bootstrap-form

Bootstrap 4 forms builder for Laravel 5.8+

5243.5k](/packages/bgaze-bootstrap-form)[mwhite/random-uagent

A library for generating random User Agents

2353.4k2](/packages/mwhite-random-uagent)

PHPackages © 2026

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