PHP code example of roelofjan-elsinga / flat-file-cms

1. Go to this page and download the library: Download roelofjan-elsinga/flat-file-cms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

roelofjan-elsinga / flat-file-cms example snippets


namespace App\Models;

use AloiaCms\Models\Model;

class PortfolioItem extends Model
{
    protected $folder = 'portfolio_items';

    protected $

use AloiaCms\Models\Article;

/**@var Article[]*/
$articles = Article::all();

$post_slug = 'this-post-is-amazing';

$article = Article::find($post_slug);

$published_articles = Article::published();

$post_slug = 'this-post-is-amazing';

$articles = Article::find($post_slug)->rawContent();

use Carbon\Carbon;

$post_slug = 'this-post-is-amazing';

Article::find($post_slug)
    ->setExtension('md') // md is the default, but you can use html as well.
    ->setMatter([
        'description' => 'This post is about beautiful things',
        'is_published' => true,
        'is_scheduled' => false,
        // Either use post_date in setMatter() or setPostDate()
        'post_date' => date('Y-m-d')
    ])
    ->setPostDate(Carbon::now())
    ->setBody('# This is the content of an article')
    ->save();

'Block' => \AloiaCms\Facades\BlockFacade::class,

{!! Block::get('content-file-name') !!}
bash
php artisan vendor:publish --provider="AloiaCms\\AloiaCmsServiceProvider"