PHPackages                             bryceandy/press - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. bryceandy/press

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bryceandy/press
===============

A markdown blog for Laravel

1.0(5y ago)05[3 PRs](https://github.com/bryceandy/press/pulls)MITPHPPHP &gt;=7.4

Since May 29Pushed 3y ago1 watchersCompare

[ Source](https://github.com/bryceandy/press)[ Packagist](https://packagist.org/packages/bryceandy/press)[ RSS](/packages/bryceandy-press/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

Press
=====

[](#press)

[![Actions Status](https://github.com/bryceandy/press/workflows/Tests/badge.svg)](https://github.com/bryceandy/press/actions)[![Total Downloads](https://camo.githubusercontent.com/4a35bc7f0cb72966108f1178d1d094639eb68e419f2f6a98f3880f0d6e5c6a92/68747470733a2f2f706f7365722e707567782e6f72672f6272796365616e64792f70726573732f642f746f74616c2e737667)](https://packagist.org/packages/bryceandy/press)[![Latest Stable Version](https://camo.githubusercontent.com/07251ab9d6e62ee7f89bb92ceee56df1c2e91bba8ccbb5422315a38c02e48e76/68747470733a2f2f706f7365722e707567782e6f72672f6272796365616e64792f70726573732f762f737461626c652e737667)](https://packagist.org/packages/bryceandy/press)[![License](https://camo.githubusercontent.com/6839ef0e445e4f7cbe60e325aafc97fb64bea5dda81e1d1f34fe9771ea0716ce/68747470733a2f2f706f7365722e707567782e6f72672f6272796365616e64792f70726573732f6c6963656e73652e737667)](https://packagist.org/packages/bryceandy/press)

This [Laravel](https://laravel.com) package can be used to publish and update your blogs using markdown files.

✅ Locate where your markdown files are (i.e local file directory, cloud)
✅ Create or update these files
✅ Select custom fields for your posts
✅ Customize how any extra field can be parsed
✅ Choose when to publish or update the posts by scheduling a command

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

[](#requirements)

Your project needs to meet the following requirements:

- PHP version &gt;=7.4
- Laravel version 7 and above
- ext-json installed

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

[](#installation)

Run the following command on your terminal to install the package

```
composer require bryceandy/press
```

Usage
-----

[](#usage)

### Publish configurations and run migrations

[](#publish-configurations-and-run-migrations)

Run the following artisan command, and the config file `press.php` will be published in the config directory.

```
php artisan vendor:publish --tag=press-config
```

You may require to store your markdown files in a specific driver. But currently this package supports the local file driver.

Update the configuration option `file.path` in the published file with the directory where you will store your markdown files.

If you do not update this path make sure you create a `blogs` directory in the root of the project and store your files.

```
php artisan migrate
```

You should also run the artisan migrate command to add the posts table.

### Markdown files syntax

[](#markdown-files-syntax)

The posts of your blog will have one required field **title**, and your own custom fields. The following is a sample syntax for your markdown files:

```
---
title: Post title
field1: Additional field
field2: Another additional field
---
The body of your post here
```

### Customize parsing of additional fields

[](#customize-parsing-of-additional-fields)

If you wish to customize how an additional field is parsed (saved in the database), or you may wish to override how the title field is parsed:

Suppose we want to create a **birthday** field that should be parsed as a [Carbon](https://carbon.nesbot.com) instance

1. Add the birthday field in the mardown file of your post

```
---
title: An awesome post
birthday: Jan 20, 2020
field: Another field
field2: Yet another field
---
The rest of the body
```

2. Create a custom class for the field and extend the `FieldContract` class
3. Inherit the static `process` method and return the value of `$field` in an array

```
