PHPackages                             harrk/laravel-commonmark - 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. harrk/laravel-commonmark

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

harrk/laravel-commonmark
========================

Compile laravel blade templates and strings into markdown

v2.0.0(6y ago)131MITPHPPHP ^7.2

Since Feb 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/Harrk/laravel-commonmark)[ Packagist](https://packagist.org/packages/harrk/laravel-commonmark)[ RSS](/packages/harrk-laravel-commonmark/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (7)Used By (0)

Laravel Commonmark
==================

[](#laravel-commonmark)

[![Build Status](https://camo.githubusercontent.com/e0dac2a86d789cdf786ab99235d496714ddb17d8d8aa5d085aab1296e74eeb60/68747470733a2f2f7472617669732d63692e6f72672f486172726b2f6c61726176656c2d636f6d6d6f6e6d61726b2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Harrk/laravel-commonmark)

Laravel Commonmark is a wrapper for [league/commonmark](https://github.com/thephpleague/commonmark)which allows for the parsing of regular Markdown as well as CommonMark. The CommonMark spec can be found at .

This package can parse Markdown inline or within blade templates using the .md.blade.php file extension.

Why?
----

[](#why)

I was looking for a Markdown compiler for Laravel and with being unable to find a package compatible with Laravel 5.6 (at the time). I figured I could take a crack at it. This also seemed like a good opportunity to gain some experience with open-source projects.

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

[](#installation)

This package has been updated to work with Laravel 6.0, just install via composer:

```
$ composer require "harrk/laravel-commonmark=~v2.0"
```

Usage
-----

[](#usage)

### Blade

[](#blade)

Simply name a blade view with the .md.blade.php extension and it'll automatically parse Markdown within the view into HTML when rendered.

Any .md.blade.php files can be included into other blade files using `@import` as you would a regular view.

### Dependency Injection

[](#dependency-injection)

```
use \League\CommonMark\CommonMarkConverter;

class MyClass {

    public function myFunction(CommonMarkConverter $converter) {
        return $converter->convertToHtml('# H1 Header');
    }

}
```

Or if you prefer using helper functions instead:

```
class MyClass {

    public function myFunction() {
        return markdown_to_html('# H1 Header');
    }

}
```

Unit Testing
------------

[](#unit-testing)

To run unit tests:

```
$ vendor/bin/phpunit
```

Alternatives
------------

[](#alternatives)

Check out [graham-campbell/markdown](https://github.com/GrahamCampbell/Laravel-Markdown) for a package that offers far greater customisation through the use of CommonMark extensions.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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

Every ~196 days

Total

4

Last Release

2422d ago

Major Versions

v1.0.3 → v2.0.02019-09-24

### Community

Maintainers

![](https://www.gravatar.com/avatar/64437724a6c23ab6dd2596863e9bde27f24bd6c6b7a52f182010b6cd7334474c?d=identicon)[Harrk](/maintainers/Harrk)

---

Top Contributors

[![Dylan-DPC](https://avatars.githubusercontent.com/u/99973273?v=4)](https://github.com/Dylan-DPC "Dylan-DPC (1 commits)")[![Harrk](https://avatars.githubusercontent.com/u/2372590?v=4)](https://github.com/Harrk "Harrk (1 commits)")

### Embed Badge

![Health badge](/badges/harrk-laravel-commonmark/health.svg)

```
[![Health](https://phpackages.com/badges/harrk-laravel-commonmark/health.svg)](https://phpackages.com/packages/harrk-laravel-commonmark)
```

###  Alternatives

[yajra/laravel-datatables-oracle

jQuery DataTables API for Laravel

4.9k33.8M339](/packages/yajra-laravel-datatables-oracle)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[cknow/laravel-money

Laravel Money

1.0k4.3M22](/packages/cknow-laravel-money)[livewire/flux

The official UI component library for Livewire.

9385.0M86](/packages/livewire-flux)[akaunting/laravel-money

Currency formatting and conversion package for Laravel

7825.3M18](/packages/akaunting-laravel-money)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)

PHPackages © 2026

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