Download the PHP package asm/markdown-content-bundle without Composer

On this page you can find all versions of the php package asm/markdown-content-bundle. 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-content-bundle

MarkdownContentBundle

Basic idea behind the project was to be able to easily provide, provision and version content without a database backend. Also quite tempting: The markdown syntax.

Build Status Latest Stable Version Total Downloads Scrutinizer Code Quality phpci build status

What does it do?

You can configure following things:

All URLs are dynamically generated and support subdirectories without limitations. MarkdowncontentBundle also supports translations! If you put your directory structure into a locale directory like it will be loaded either when using w3c urls with locale or if locale is set in your kernel. If you want locale urls, please enable the config directive.

Basics

Some things you need to know!

Configuration

You can set following things in your app/config.yml:

asm_markdown_content:
    content_directory: 'app/Resources/markdown'
    content_loader:    'file-loader'
    route_prefix:      'content'
    markdown_provider: 'php-markdown'
    #locale_url:        false

Expansion

If you want, you can easily add new markdown parsers or content loaders, even hooks. For each type there's an interface you can build a tagged service upon:

Loaders

Asm\MarkdownContentBundle\Content\ContentLoaderInterface

asm_markdown_content.content_file_loader:
class: 'Asm\MarkdownContentBundle\Content\ContentFileLoader'
arguments:
    - '%kernel.root_dir%'
    - '%asm_markdown_content.content_directory%'
    - '%asm_markdown_content.content_path_depth%'
tags:
    - { name: asm_markdown_content.content_loader, alias: file-loader }

Parsers

Asm\MarkdownContentBundle\Parser\ParserInterface

asm_markdown_content.parsedown_parser:
    class: 'Asm\MarkdownContentBundle\Parser\ParsedownParser'
    tags:
        - { name: asm_markdown_content.parser, alias: parsedown }

Hooks

Asm\MarkdownContentBundle\Hook\HookDataInterface Asm\MarkdownContentBundle\Hook\HookContentInterface

asm_markdown_content.front_matter_content_hook:
    class: 'Asm\MarkdownContentBundle\Hook\FrontMatterContentHook'
    tags:
        - { name: asm_markdown_content.hook, alias: front_matter }

Hook system

The system is based on two events:

For each registered hook service you have to set the type of hook in the getType() method. It's either 'post' or 'pre'. The hook just has one more interface method workContent() which receives the content array. Pre-hooks receive the file content ($content['content']) as an array of lines, post hook will get the whole stuff as a HTML string, because it's already markdown-converted.

$content = array(
    'content' => array()|string,
    'data'    => array(),
);

That's also the data structure you're needed to return from workContent(). What you're doing with the data is completely up to you. The main difference between 'pre' and 'post' is the state of either data nodes. In 'pre', all content is still raw markdown, data is maybe already prefilled by other hooks (metadata hook e.g.). 'post' gets the already converted html string from your configured markdown parser. There you have the possibility to change some tags, add classes, whatever you want.

Templating

The base layout uses bootstrap3 via CDN and provides some base for your own designs. Just override

vendor/asm/markdown-content-bundle/Asm/MarkdownContentBundle/Resources/views/layout.html.twig

in your own Bundle(s). Have a look at the variable names! Content template:

vendor/asm/markdown-content-bundle/Asm/MarkdownContentBundle/Resources/views/Content/index.html.twig

Meta data

Since there is an accepted format for page meta in markdown, I've switched to front matter. The general format is

---
title: Awesome page title
author: me, myself and I
date: 2014/02/09
sample_data: { some: data, more: data_stuff }
---

This block needs to be the first thing in your markdown file, no whitespaces or newlines before, and the FrontMatterContentHook will extract the contents as YAML and provide the data within the content array. So you have the opportunity to place virtually everything additional you need witin that block. Besides that, default metadata will be placed in the root of the data array. They are the filled with blank content if not set via front matter:

$defaults= array(
    'title'       => '',
    'description' => '',
    'author'      => '',
    'date'        => '',
    'robots'      => '',
    'content'     => '',
    'name'        => '',
    'keywords'    => '',
);

The front matter block from above will result in this array:

$data = array(
    'title'       => 'Awesome page title',
    'author'      => 'me, myself and I',
    'date'        => '2014/02/09',
    'description' => '',
    'robots'      => '',
    'content'     => '',
    'name'        => '',
    'keywords'    => '',
    'sample_data' => array(
        'some'    => 'data',
        'more'    => 'data_stuff',
    ),
);

The data array is available in your TWIG template and fill the fields automatically ;-)

Exporting of static pages

If you want to export all your markdown files as HTML, you can do so with following command:

app/console asm:markdown:export <absolute_export_dir> -i <optional_import_dir>

The exporter will use the configured markdown parser and if no import directory is provided, the configured one will be used by default. Your content is then rendered file by file into an equivalent folder stucture within the export directory, based on the provided templates. Keep in mind to add any css/js files to your static content directory :-)

Upcoming/planned

License

AsmMarkdownContentBundle is licensed under the MIT license. See the LICENSE for the full license text.

Free Software, Hell Yeah!


All versions of markdown-content-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
symfony/config Version ~2.2
symfony/console Version ~2.2
symfony/dependency-injection Version ~2.2
symfony/filesystem Version ~2.2
symfony/finder Version ~2.2
symfony/yaml Version 2.5.*@dev
symfony/event-dispatcher Version 2.5.*@dev
symfony/http-kernel Version ~2.2
erusev/parsedown Version ~0.9
michelf/php-markdown Version ~1.4
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 asm/markdown-content-bundle contains the following files

Loading the files please wait ....