ljonesfl / blahg
A largely ridiculous blog implementation.
0.0.13
2024-12-15 22:03 UTC
Requires
- php: 8.1.*
- league/commonmark: ^1.5
- suin/php-rss-writer: ^1.6
- symfony/yaml: ^6.4
Requires (Dev)
- phpunit/phpunit: ^9
README
Created so that I can write blog articles in vi using markdown. Each article consists of 2 files, a descriptor written in yaml and the actual article written in markdown.
Descriptor
Example: 10-reasons-broccoli.yaml
title: 10 Reasons Why I Love Broccoli
slug: 10-reasons-why-i-love-broccoli
datePublished: "2018-12-27"
category: Food
tags:
- broccoli
- food
path: 10-reasons-broccoli.md
Usage
Installation
The best way to install blahg is via Composer
The package is located here
Install Composer
curl -sS https://getcomposer.org/installer | php
Install the Package
php composer.phar require ljonesfl/blahg
Setup
$Blog = new Blagh/Repository( '/blahg' );
$Articles = $Blog->getList();
Render List
<h1>Blahgs</h1>
<?php
foreach( $Articles as $Article)
{
?>
<h3><a href="/blahg/<?= $Article->getSlug() ?>"><?= $Article->getTitle() ?></a></h3>
Category: <?= $Article->getCategory() ?><br>
Tags:
<?php
$Tags = $Article->getTags();
foreach( $Tags as $Tag )
{
?>
<small>#<?= $Tag ?></small>
<?php
}
?><br>
<small>Date published: <?= $Article->getDatePublished() ?></small><br>
<?php
}
?>
Render Article
try
{
$Article = $Blahg->getArticle( '10-reasons-why-i-love-broccoli' );
}
catch( ArticleNotFound $Exception )
{}
catch( ArticleMissingBody $Exception )
{}
Roadmap
Repository::getAllByDateRange( string $Start, string $End ) : array
Repository::getAllByPage( int $PageNum, int $PageCount ) : array