Download the PHP package jcfrane/laravel-md-blog without Composer

On this page you can find all versions of the php package jcfrane/laravel-md-blog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-md-blog

laravel-md-blog

Write blog posts as markdown files with YAML front matter. No database, no CMS — just files and a clean query API.

Built for Laravel 12+ / PHP 8.2+.

Installation

Publish the config (optional):

Usage

Writing Posts

Create .md files in resources/markdown/blog/ (configurable) with YAML front matter:

Front matter fields:

Field Required Default
title No Filename
slug No Filename
date No File modification time
tags No []
category No ""
excerpt No Generated from the body (see below)
cover No null
published No true

Any additional front matter fields are available via $post->meta.

Excerpt. When excerpt is omitted, one is built from the first excerpt_length characters (default 160) of the body's prose. Headings and code blocks are skipped, and the cut lands on a word boundary.

Cover. cover works like an image in the body: a path relative to the blog directory (images/cover.jpg) is rewritten to the image route, while absolute URLs are kept as they are. The resolved URL is on $post->cover.

Querying Posts

All query methods return Laravel Collections (except find() which returns a Post or null, and paginate() which returns a LengthAwarePaginator). Results are newest first. Drafts (published: false) are automatically excluded.

Query Builder

For anything beyond a single filter, chain conditions on a query:

Pagination

paginate() returns a LengthAwarePaginator, so it renders in Blade with {{ $posts->links() }} and serializes for Inertia as { data, links, meta... } the same way an Eloquent paginator does:

The current page is read from the request's page query string. Pass a different name or an explicit page with paginate(9, 'p', $page).

Previous, Next and Related

Related posts are scored by shared tags (two points each) plus one point for the same category. Posts with no overlap are left out.

The Post Object

Each post is an immutable Post DTO with these properties:

Post implements Arrayable, Jsonable, and JsonSerializable for clean Inertia/API integration:

Custom Post Model

You can extend the base Post class to customize how posts are built — for example, to apply syntax highlighting to code blocks.

Set the post_class config option to your custom class:

Then create a class that extends Post and overrides the make() factory method:

The make() method receives all post attributes as an array. You can modify any of them (html, title, body, etc.) before calling parent::make() to construct the post.

Cached posts built with a different class are re-parsed automatically, so no cache clear is needed after changing post_class.

Images

The package automatically handles images stored within your blog directory.

Relative Images

If you have an image at resources/markdown/blog/images/photo.png, you can reference it in your markdown as:

The package will automatically rewrite this URL to a dedicated route that serves the image securely.

Image Configuration

By default, images are served with a long cache duration (24 hours). You can customize this in the config:

When images.enabled is true (default), the package registers a route at /{route_prefix}/images/{path} to serve your assets.

Absolute URLs (APIs, mobile apps, email)

Image URLs are root-relative by default (/md-blog/images/photo.png). That breaks as soon as the HTML leaves your web page: a mobile app reading the JSON API or an email client has no origin to resolve against. Set the base URL and every image and cover URL becomes absolute:

Rendered HTML is cached, so the base URL is baked in at parse time. Run MdBlog::clearCache() after changing it.

Email

Send blog posts as emails to your subscribers. The feature is opt-in and disabled by default.

Setup

  1. Set the environment variables:

  2. Implement the EmailRecipient interface on your model:

The ReceivesPostMail trait provides defaults for emailRecipients() (returns static::cursor()), getEmailAddress() ($this->email), and getEmailName() ($this->name). Override any of these if your model differs.

Sending

Three ways to send:

Queue Support

Enable queued sending to avoid blocking:

Customizing the Email Template

Publish the views to customize the email layout:

This copies the template to resources/views/vendor/md-blog/mail/post.blade.php.

Configuration

Caching

Posts are cached per-file with automatic staleness detection — when a file is modified, the cached entry is automatically refreshed on the next read. A slug index is cached alongside so find() opens one file instead of scanning the directory; it rebuilds itself when a file is added, moved, removed or its slug changes. Use MdBlog::clearCache() to force a full cache bust.

Development

Running Tests

Workbench (Demo App)

The package includes a workbench powered by Orchestra Testbench:

Visit http://localhost:8000/blog to see the demo blog.

License

MIT


All versions of laravel-md-blog with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^12.0 || ^13.0
illuminate/cache Version ^12.0 || ^13.0
illuminate/mail Version ^12.0 || ^13.0
league/commonmark Version ^2.5
spatie/yaml-front-matter Version ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jcfrane/laravel-md-blog contains the following files

Loading the files please wait ...