Download the PHP package apxcde/markdown-blog without Composer

On this page you can find all versions of the php package apxcde/markdown-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 markdown-blog

apxcde/markdown-blog

Latest Version on Packagist Tests

A Laravel package that turns a directory of markdown files into blog articles.

It gives you:

It deliberately stops there: routes, controllers, Livewire components, and views stay in your application.

Requirements

Installation

The service provider and the MarkdownBlog facade alias are registered automatically through Laravel package discovery.

Configuration

Publish the config file to change where articles live or how they are formatted:

Key Purpose
articles_path Directory scanned for articles. A missing directory yields an empty collection rather than an error.
article_filename Only files with this exact name are treated as articles.
excerpt_length Truncation length for the excerpt generated when description is absent. An ellipsis is appended, so the result runs a few characters longer.
date_format PHP date format applied to formatted_date.
show_drafts Visibility of status: draft articles. null (default) shows them only when the application environment is local; true or false forces them on or off in every environment.

Article structure

Each article is a directory containing one page.md. The directory is scanned recursively, so you are free to group articles into subdirectories.

Frontmatter fields

Every field is optional. When one is absent, the package falls back as follows. Note that a key which is present but blank (title:) counts as a value — you get an empty string, not the fallback.

Field Fallback
slug The article's parent directory name. Either way the value is passed through Str::slug(). An article that resolves to an empty slug is skipped.
title Str::headline() of the slug, so first-post becomes First Post.
description An excerpt built from the body: markdown rendered, tags stripped, whitespace collapsed, truncated to excerpt_length.
author An empty string.
date An empty string, and formatted_date is then null.
status current. Recognized values are current, archive, and draft (case-insensitive). Anything else, including a blank status:, is treated as current for backward compatibility. Start new posts as status: draft so they stay hidden until you publish them.

Frontmatter syntax

This is not a YAML parser. It handles a small, deliberate subset: flat key: value pairs, one per line. Values may be unquoted, single-quoted, or double-quoted; surrounding quotes are stripped and every value is returned as a string, so 42 and true are not cast. Blank lines, # comments, and lines with no colon are skipped.

Richer YAML is not rejected — it is quietly mis-read, so avoid it:

You write You get
author: then an indented name: Rick Indentation is ignored, so name is hoisted to a top-level key and author becomes ''.
tags: then - php, - laravel The - lines have no colon and are dropped; tags becomes ''.
items: then - name: foo That line does contain a colon, so you get a literal key - name.
tags: [php, laravel] Kept verbatim as the string '[php, laravel]'.

Keep frontmatter flat and scalar, and parse richer values (a comma-separated list, for example) in your own code.

Usage

Facade

Resolved service

Repository

In a controller

API

all(): Illuminate\Support\Collection

Returns every visible article as an array, sorted by date descending — newest first. Articles with no date, or with a date Carbon cannot parse, sort last. If articles_path does not exist, you get an empty collection. all() does not hide archived articles; use current(), archived(), or listed() when a consumer wants a subset.

Drafts (status: draft) are included only while drafts are visible. By default that means the application environment is local; set the show_drafts config key to true or false to override that in any environment. findBySlug() uses the same gate, so a hidden draft's slug resolves to null.

Each repository instance walks articles_path once and reuses the result for every call, so listed() followed by archived() costs a single directory scan. Resolve a fresh instance to pick up files added since.

current(): Illuminate\Support\Collection

Returns articles whose normalized status is current, still newest first. Drafts are never included.

archived(): Illuminate\Support\Collection

Returns articles whose normalized status is archive, still newest first.

drafts(): Illuminate\Support\Collection

Returns articles whose normalized status is draft, newest first, while drafts are visible. Otherwise an empty collection.

listed(): Illuminate\Support\Collection

Returns the public listing: current posts, plus drafts while they are visible, still newest first. Archived posts are omitted.

findBySlug(string $slug): ?array

Returns the matching visible article, or null. The argument is run through Str::slug() first, so Infinite Scroll and infinite-scroll both match. Draft slugs resolve only while drafts are visible.

Returned article shape

date is returned exactly as written in the frontmatter. formatted_date is that date parsed by Carbon and rendered with date_format; it is null when no date is set, and falls back to the raw string when the date cannot be parsed. content is the markdown body with the frontmatter block removed, trimmed, and left unrendered — render it in your view.

Testing

Contributing

This package is developed inside ApexCode's Turbine platform monorepo and published here as a one-way mirror. Please open issues on this repository.

Pull requests are welcome, but note that this repository is machine-managed: its branches are overwritten by the next sync from the monorepo, so a PR cannot simply be merged here. Accepted changes are ported upstream and land back through a later sync, with credit preserved.

License

The MIT License (MIT). See LICENSE.md for details.


All versions of markdown-blog with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^13.0
spatie/laravel-package-tools Version ^1.92
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 apxcde/markdown-blog contains the following files

Loading the files please wait ...