PHPackages                             tomakee/laravel-markdown-wrapper - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. tomakee/laravel-markdown-wrapper

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

tomakee/laravel-markdown-wrapper
================================

Simple Laravel wrapper class for markdown parser.

1.0.12(8y ago)030MITPHPPHP &gt;=5.6.4

Since Oct 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/tomakee/laravel-markdown-wrapper)[ Packagist](https://packagist.org/packages/tomakee/laravel-markdown-wrapper)[ Docs](https://github.com/tomakee/laravel-markdown-wrapper#readme)[ RSS](/packages/tomakee-laravel-markdown-wrapper/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (6)Versions (5)Used By (0)

laravel-markdown-wrapper
========================

[](#laravel-markdown-wrapper)

[![Build Status](https://camo.githubusercontent.com/1906381c8ef66c8ad802516dd3d3b196d116ad46755bffcb99f87470769a886a/68747470733a2f2f7472617669732d63692e6f72672f746f6d616b65652f6c61726176656c2d6d61726b646f776e2d777261707065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tomakee/laravel-markdown-wrapper)[![Latest Stable Version](https://camo.githubusercontent.com/fbcc1c704a43bca66ad7ec0a957ce8109dfb3d352890784c8ecb46f50c0ad24f/68747470733a2f2f706f7365722e707567782e6f72672f746f6d616b65652f6c61726176656c2d6d61726b646f776e2d777261707065722f762f737461626c65)](https://packagist.org/packages/tomakee/laravel-markdown-wrapper)[![License](https://camo.githubusercontent.com/ff593d7e1588a012933df667011c810b8c99a42f3cb14946fcb8a462bb8903b7/68747470733a2f2f706f7365722e707567782e6f72672f746f6d616b65652f6c61726176656c2d6d61726b646f776e2d777261707065722f6c6963656e7365)](https://packagist.org/packages/tomakee/laravel-markdown-wrapper)

[日本語ドキュメント](https://github.com/tomakee/laravel-markdown-wrapper/blob/master/README.ja.md)

Simple Laravel wrapper class for markdown parser such as [michelf/php-markdown](https://github.com/michelf/php-markdown) or [cebe/markdown](https://github.com/cebe/markdown), etc.

This package is just wrapper classes for Laravel, it won't parse markdown by itself, for that you need a actual parser. Add your favorite Markdown Parser.

Environment
-----------

[](#environment)

- PHP &gt;= 5.6
- [Laravel](https://laravel.com/) &gt;= 5.4
- Markdown Parser
    - [michelf/php-markdown](https://github.com/michelf/php-markdown)
    - [cebe/markdown](https://github.com/cebe/markdown)
    - etc.

Functions
---------

[](#functions)

- Blade directives: `@markdown`, `@endmarkdown`, `@markdownFile`.
- Laravel helpers: `markdown()`, `markdown_config()`, `markdown_file()`, `markdown_capture()`.
- Laravel facade: `Markdown::parse()`, `Markdown::setConfig()`, `Markdown::file()`, `Markdown::start()`, `Markdown::end()`
- Wrapper class main: `Tomakee\Markdown\Parser`

Howto Install PHP Composer
--------------------------

[](#howto-install-php-composer)

You need to install [php coomposer](https://getcomposer.org/) first if you don't have it in your system.

```
#install composer (Linux or MacOS)
curl -sS https://getcomposer.org/installer | php

#move composer.phar into somewhere accessable (such as /usr/local/bin)
mv composer.phar /usr/local/bin/composer
chmod 755 /usr/local/bin/composer
```

Howto Create Laravel Project
----------------------------

[](#howto-create-laravel-project)

After install php composer, you need to create a [Laravel](https://laravel.com/) project.
You can skip this step if you simply add it in your project.

```
composer create-project --prefer-dist laravel/laravel LARAVEL_PROJECT_DIR

#or with version
composer create-project --prefer-dist laravel/laravel "5.4.*" LARAVEL_PROJECT_DIR
```

Howto Install
-------------

[](#howto-install)

After install [Laravel](https://laravel.com/), you can install this package with follow commands.

```
cd LARAVEL_PROJECT_DIR
composer require tomakee/laravel-markddown-wrapper
php artisan vendor:publish
```

Add Laravel Service Provider into config/app.php.

```
//config/app.php
return [
    'providers' => [
        ...
        Tomakee\Markdown\MarkdownServiceProvider::class,
    ],
    ...
];
```

And add your favorite Markdown Parser such as:

```
cd LARAVEL_PROJECT_DIR
composer require michelf/php-markdown
#or
composer require cebe/markdown
```

Blade Directives
----------------

[](#blade-directives)

You can create view mixed markdown and Blade.
For example:

#### single line

[](#single-line)

```
@markdown('some markdown text.')

```

#### multiple line

[](#multiple-line)

```
@markdown
some markdown text.
[link text](/link/path)
@endmarkdown

```

#### include markdown file

[](#include-markdown-file)

```
@markdownFile('path.to.markdownfile')  {{-- path format is same as Laravel view. --}}

{{--
You can set different resources path.
But if your project always use different path from default,
change the config setting (app/config/markdown.php).
--}}

@markdownFile('path.to.markdownfile', [resources path,,,]);

```

Laravel Helpers
---------------

[](#laravel-helpers)

Anywhere Controller, etc., you can access to the wrapper class.

#### markdown()

[](#markdown)

```
//parse markdown text
$html = markdown('some markdown text.');
```

#### markdown\_config()

[](#markdown_config)

```
//change parser config
$parser = markdown_config('hard_wrap', false);
$html = $parser->parse('some markdown text.');

//change parser config and parse markdown
$html = markdown_config(['hard_wrap' => false, 'code_class_prefix' => 'prefix-'])
        ->parse('some markdown text.');
```

#### markdown\_file()

[](#markdown_file)

```
//parse markdown file
$html = markdown_file('path.to.markdownfile');  //path format is same as Laravel view.

//You can set different resources path.
//But if your project always use different path from default,
//change the config setting (app/config/markdown.php).

$html = markdown_file('path.to.markdownfile', [resources path,,,,]);
```

#### markdown\_capture()

[](#markdown_capture)

```
$html = markdown_capture(function () {
    echo 'some markdown text.';
});

//with params
$html = markdown_capture(function () use ($args1, $args2) {
    echo $args1 . $args2 . 'some markdown text.';
});
```

Laravel Facade
--------------

[](#laravel-facade)

In your Controller, etc., you can access to the wrapper class with Laravel Facade.

#### Import markdown facade

[](#import-markdown-facade)

To use Laravel Facade, first, you need import Markdown Facade.
Class path:

```
use Tomakee\Markdown\Facades\Markdown;
```

#### Markdown::parse()

[](#markdownparse)

```
//parse markdown text
$html = Markdown::parse('some markdown text.');
```

#### Markdown::file()

[](#markdownfile)

```
//parse markdown file
$html = Markdown::file('path.to.markdownfile');  //path format is same as Laravel view.

//You can set different resources path.
//But if your project always use different path from default,
//change the config setting (app/config/markdown.php).

$html = Markdown::file('path.to.markdownfile', [resources path,,,]);
```

#### Markdown::setConfig()

[](#markdownsetconfig)

```
//change parser config
$html = Markdown::setConfig('hard_wrap', false)
    ->parse('some markdown text.');

//temporary change parser config
$html = Markdown::setConfig('hard_wrap', false)->parse('some markdown text.');
Markdown::setConfig('hard_wrap', true);
```

#### Markdown::PARSER\_METHOD()

[](#markdownparser_method)

It's accessable to the original parser method directly through to `__call()` magic method:

```
//direct access to the original parser methods if you need
Markdown::PARSER_METHOD();
```

Laravel App Container
---------------------

[](#laravel-app-container)

It can access wrapper class instance from binded application container. See this php: [src/MarkdownServiceProvider.php](https://github.com/tomakee/laravel-markdown-wrapper/blob/master/src/MarkdownServiceProvider.php#L54).

```
Tomakee\Markdown\MarkdownServiceProvider::register()

```

#### app('markdown'), app('Tomakee\\Markdown\\Parser')

[](#appmarkdown-apptomakeemarkdownparser)

```
//get instance
$instance = app('markdown');
//or
$instance = app('Tomakee\Markdown\Parser');
```

#### app('markdown')-&gt;parse()

[](#appmarkdown-parse)

```
//parse markdown text
$html = app('markdown')->parse('some markdown text.');
```

#### app('markdown')-&gt;file()

[](#appmarkdown-file)

```
//parse markdown file
$html = app('markdown')->file('path.to.markdownfile');  //path format is same as Laravel view.

//You can set different resources path.
//But if your project always use different path from default,
//change the config setting (app/config/markdown.php).

$html = app('markdown')->file('path.to.markdownfile', [resources path,,,]);
```

#### app('markdown')-&gt;setConfig()

[](#appmarkdown-setconfig)

```
//change parser config
$html = app('markdown')->setConfig('hard_wrap', false)
    ->parse('some markdown text.');

//temporary change parser config
$html = app('markdown')->setConfig('hard_wrap', false)
    ->parse('some markdown text.');
app('markdown')->setConfig('hard_wrap', true);
```

#### app('markdown')-&gt;PARSER\_METHOD()

[](#appmarkdown-parser_method)

It's accessable to the original parser method directly through to `__call()` magic method:

```
//direct access to the original parser methods if you need
app('markdown')->PARSER_METHOD();
```

Markdown Parser Config
----------------------

[](#markdown-parser-config)

Markdown wrapper class config is placed at `app/config/markdown.php` after execute:

```
cd LARAVEL_PROJECT_DIR
php artisan vendor:publish
```

#### Example:

[](#example)

```
[
    'default'    => 'github',
    'resources'  => [resource_path('views')],
    'extensions' => ['md', 'md.blade.php', 'blade.php', 'php'],
    [
        'id'      => 'github',
        'parser'  => \cebe\markdown\GithubMarkdown::class,
        'methods' => [
                'single' => 'parseParagraph',
                'multi'  => 'parse',
        ],
        'config'  => [
                'html5'               => true,
                'enableNewlines'      => true,
                'keepListStartNumber' => false,
        ],
    ],
];
```

#### default

[](#default)

Automatically loading parser class id (see `Parser settings > id`).
(*default value: 'michelf-extra'*)

#### resources

[](#resources)

Markdown file resources path. Markdown files will be finded in this path. If they are placed in different pathes, then should be set all of pathes in this array().
(*default value: \[resource\_path('views')\]*)

#### extensions

[](#extensions)

Markdown file extensions array.
(*default value: \['md', 'md.blade.php', 'blade.php', 'php'\]*)

#### Parser settings

[](#parser-settings)

- id : Unique id string for the parser class. If it's unique, anything is possible.
- parser : Full path string of the parser class such as `\namespace\to\class::class`.
- methods : A single or multiple line to parse markdown method name. Array keys are "single" and "multi".
    - single : for single line markdown.
    - multi : for multipule line markdown.
- config : Parser class config properties array. If there is no config, value must be empty array().

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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

Every ~34 days

Total

4

Last Release

3031d ago

Major Versions

0.2.0 → 1.0.112017-11-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/1bc2f8a9af049a01df214f4dd2431c101ddd82ee374273b43629d38d16b1b024?d=identicon)[Tommy A.](/maintainers/Tommy%20A.)

---

Top Contributors

[![tomakee](https://avatars.githubusercontent.com/u/6982444?v=4)](https://github.com/tomakee "tomakee (29 commits)")

---

Tags

laravelmarkdownextensiblemarkdown-extra

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tomakee-laravel-markdown-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/tomakee-laravel-markdown-wrapper/health.svg)](https://phpackages.com/packages/tomakee-laravel-markdown-wrapper)
```

###  Alternatives

[cebe/markdown

A super fast, highly extensible markdown parser for PHP

1.0k32.5M136](/packages/cebe-markdown)[cebe/markdown-latex

A super fast, highly extensible markdown parser for PHP, that converts markdown files into latex

51766.1k7](/packages/cebe-markdown-latex)[vtalbot/markdown

Markdown compiler for Laravel 5

100204.2k3](/packages/vtalbot-markdown)[dniccum/nova-documentation

A Laravel Nova tool that allows you to add markdown-based documentation to your administrator's dashboard.

37116.4k](/packages/dniccum-nova-documentation)[alfredo-ramos/parsedown-extra-laravel

A Parsedown Extra package for Laravel

30155.1k1](/packages/alfredo-ramos-parsedown-extra-laravel)[torchlight/torchlight-commonmark

A Commonmark extension for Torchlight, the syntax highlighting API.

29256.6k6](/packages/torchlight-torchlight-commonmark)

PHPackages © 2026

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