abr4xas/prealphacms

The flat-file blog engine for PHP... preAlphaCMS is a simple, light-weight, flat-file blog engine in PHP

dev-master 2020-08-11 23:30 UTC

This package is auto-updated.

Last update: 2020-08-11 23:30:49 UTC


README

preAlphaCMS

Latest Stable Version Total Downloads Latest Unstable Version License composer.lock

how to install

Add this to your composer.json

"require": {
    "abr4xas/prealphacms": "dev-master"
}

and

$ composer update
$ composer dumpautoload -o // optional

creating content

To write a new post, create a text file with name in the format first-post.md. An article will have a meta part and a content part which must be separated with a blank line. Article must start with the meta informations stored in json format. "title", "date" and "slug" are the mandatory meta information. For example, metadata of this artilce will look like this.

{
    "title" : "Hello World",
    "date"  : "YYYY-MM-DD HH:MM",
    "slug"  : "frist-post",
    "author": "",
    "summary": "This is my frist post",
}

### This is my frist post title

This is my first post content

usage

<?php

require 'vendor/autoload.php';

use preAlphaCMS\Api;

$contentPaht = '/path/to/content';

$pac = new Api;

$articles = $pac->getArticles($contentPaht);


foreach ($articles as $article) {
    //print("<pre>".print_r($article,true)."</pre>");
}

$content = $pac->getPageOrPostContent($blogPaht,'article-slug');

print("<pre>".print_r($content,true)."</pre>");