ronanguilloux/silexmarkdownserviceprovider

Silex micro-framework Markdown service provider

1.0.0 2013-07-07 12:16 UTC

README

Silex PHP micro-framework Markdown Service Provider

To be used with Michel Fortin's michelf/php-markdown PHP parser for Markdown and Markdown Extra derived from the original Markdown.pl by John Gruber

Build Status Total Downloads

Implementations examples:

Usage

<?php

# app.php

use Rg\Silex\Provider\Markdown\MarkdownServiceProvider;

$app->register(new MarkdownServiceProvider(), array(
    'md.path' => __DIR__ .'/relative-path-to-markdown-files-directory')
);

// Retrieve .md file content
$markdown = $app['md.finder']->getContent('path-to-mardown-file');

// Parse it into html
$html = $app['md.parser']->transform($markdown);

Tests

Tests need --dev option while installing dependecing using composer:

$ composer.phar install --dev
$ wget http://pear.phpunit.de/get/phpunit.phar
$ chmod +x phpunit.phar
$ ./phpunit.phar

License

This Silex Service Provider is released under the MIT License.
See the bundled LICENSE file for details.
You can find a copy of this software here: https://github.com/ronanguilloux/SilexMarkdownServiceProvider