Looking to hire Laravel developers? Try LaraJobs

laravel-paper-yaml-driver maintained by thecodechef

Description
A YAML Driver for Laravel Paper
Last update
2026/08/21 11:57 (dev-main)
License
Downloads
8

Comments
comments powered by Disqus

A YAML Driver for Laravel Paper

Installation

You can install the package via Composer:

composer require --dev thecodechef/laravel-paper-yaml-driver:dev-main

You may publish all of the package's resources at once:

php artisan vendor:publish --tag="laravel-paper-yaml-driver"

Or, you may publish each resource individually:

Publishing the Configuration File

php artisan vendor:publish --tag="laravel-paper-yaml-driver-config"

Usage

# app/Providers/AppServiceProviders.php

use JacobJoergensen\LaravelPaper\Drivers\DriverRegistry;
use LaravelPaper\YamlDriver\YamlDriver; 

# ...

public function boot(): void
{
    app(DriverRegistry::class)->register('yaml', YamlDriver::class);
}
<?php

# app/Models/Post.php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use JacobJoergensen\LaravelPaper\Attributes\ContentPath;
use JacobJoergensen\LaravelPaper\Attributes\Driver;
use JacobJoergensen\LaravelPaper\Attributes\Timestamps;
use JacobJoergensen\LaravelPaper\Paper;

#[Driver('yaml')]
#[ContentPath('content/users')]
#[Timestamps]
class Post extends Model
{
    use Paper;
}
# content/first-post.ya?ml

id: 1
title: First Post
author: Jeremy Bolding
draft: true
tags:
  - laravel-paper
  - yaml
categories:
  - php
  - laravel
content: |
  this is my first post
{{-- resources/views/posts/list.blade.php --}}

@php
    $posts = \App\Models\Post::all();
@endphp
<div class="posts">
    @foreach($posts as $post)
        <a href="{{ $post->permalink }}" class="post">
            <span class="post-title">{{ $post->title }}</span>
            <span class="post-author">By: {{ $post->author }}</span>
            <span class="post-date">{{ $post->updated_at ? "Updated: $post->updated_at" : "Posted: $post->created_at" }}</span>
            <div class="post-tags">
                @foreach($post->tags as $tag)
                    <span class="post-tag">{{ $tag }}</span>
                @endforeach
            </div>
            <div class="post-categories">
                @foreach($post->categories as $category)
                    <span class="post-category">{{ $category }}</span>
                @endforeach
            </div>
            <span class="post-date">Posted: {{ $post->created_at }}</span>
            <span class="post-summary">{{ Str::limit($post->content, 30, '...') }}</span>
        </a>
    @endforeach
</div>

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Thank you for considering contributing to Laravel Paper Yaml Driver! Please review our contributing guide to get started.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

Laravel Paper Yaml Driver is open-sourced software licensed under the MIT license.