PHPackages                             thesimonharms/lontar - 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. thesimonharms/lontar

ActiveLibrary

thesimonharms/lontar
====================

A minimal headless blog API package for Laravel with Markdown support.

v1.0.0(1mo ago)03↓100%MITPHPPHP ^8.2

Since Mar 21Pushed 1mo agoCompare

[ Source](https://github.com/thesimonharms/lontar)[ Packagist](https://packagist.org/packages/thesimonharms/lontar)[ RSS](/packages/thesimonharms-lontar/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (2)Used By (0)

Lontar
======

[](#lontar)

A minimal, headless blog API package for Laravel. Ships a `Post` model, full CRUD controller, and API routes. Stores post bodies as Markdown and renders them server-side via `league/commonmark`.

No opinions on auth, frontend, or theming — bring your own.

---

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

[](#requirements)

- PHP 8.2+
- Laravel 11 or 12
- `laravel/sanctum` installed in the consuming app (for authenticated endpoints)

---

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

[](#installation)

```
composer require lontar/blog
```

The service provider is auto-discovered. Run migrations:

```
php artisan migrate
```

That's it. The API routes are registered automatically under `/api`.

---

Endpoints
---------

[](#endpoints)

### Public

[](#public)

MethodEndpointDescription`GET``/api/posts`Paginated list of published posts (`title`, `slug`, `excerpt`, `published_at`)`GET``/api/posts/{slug}`Full detail for a single published postPosts with a `null` `published_at` or a future `published_at` are treated as drafts and excluded from public responses.

### Authenticated (`auth:sanctum`)

[](#authenticated-authsanctum)

MethodEndpointDescription`GET``/api/posts/drafts`Paginated list of unpublished posts`POST``/api/posts`Create a new post`PUT``/api/posts/{slug}`Update a post`DELETE``/api/posts/{slug}`Delete a post`POST``/api/posts/{slug}/publish`Set `published_at` to now`POST``/api/posts/{slug}/unpublish`Set `published_at` to null---

Request Bodies
--------------

[](#request-bodies)

### `POST /api/posts`

[](#post-apiposts)

```
{
    "title": "My Post Title",
    "body": "Markdown content here.",
    "excerpt": "Optional short summary.",
    "published_at": "2026-03-10T00:00:00Z"
}
```

`slug` is derived automatically from `title`. `excerpt` and `published_at` are optional — omit `published_at` to save as a draft.

### `PUT /api/posts/{slug}`

[](#put-apipostsslug)

Same fields as above, all optional. If `title` is updated, `slug` is regenerated.

---

Markdown
--------

[](#markdown)

Post bodies are stored as raw Markdown. The `Post` model exposes a `rendered_body` attribute that converts the body to HTML on access via `league/commonmark`:

```
$post->rendered_body; // HTML string
```

Use this in your views when rendering post content. The raw `body` field is always available too.

---

Post Model
----------

[](#post-model)

```
use Lontar\Blog\Models\Post;

// Published posts
Post::published()->get();

// All posts including drafts
Post::all();

// Find by slug
Post::where('slug', 'my-post')->firstOrFail();
```

The `published` scope filters to posts where `published_at` is not null and not in the future.

---

Auth
----

[](#auth)

This package ships with `auth:sanctum` on write routes but does not install or configure Sanctum. Set it up in your consuming app:

```
composer require laravel/sanctum
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
php artisan migrate
```

Then ensure your `api` middleware group includes `sanctum` in `bootstrap/app.php` or `app/Http/Kernel.php`.

---

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

52d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0bb642988f06f69a5aeaebdf6970f5812b2eddfe4e49aac2006f12116478dc53?d=identicon)[thesimonharms](/maintainers/thesimonharms)

---

Top Contributors

[![thesimonharms](https://avatars.githubusercontent.com/u/172079607?v=4)](https://github.com/thesimonharms "thesimonharms (8 commits)")

### Embed Badge

![Health badge](/badges/thesimonharms-lontar/health.svg)

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

###  Alternatives

[livewire/livewire

A front-end framework for Laravel.

23.5k75.5M1.8k](/packages/livewire-livewire)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

6392.1k](/packages/masterro-laravel-mail-viewer)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)

PHPackages © 2026

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