I want to use Michel Fortin's PHP Markdown parser. The new style requires the user to set up a PSR-0-compatible autoloader. However, the instructions also state:
If you don’t want to use autoloading you can do a classic require_once to manually include the files prior use instead.
Unfortunately there are no instructions on simply using require_once. I don't want to use an autoloader, how can I use this Markdown parser to parse my string of Markdown?
EDIT: Also, is it possible to use the parser with require_once
inside a function (and outside the global scope)? The problem with use
is it must be used globally which seems to make require_once
required in the global scope. My preference is to only require_once
if necessary in a function and outside the global scope.
There's really only two files you might need to require.
For regular Mardown:
require_once '/path/to/code/Michelf/Markdown.php';
$my_html = \Michelf\Markdown::defaultTransform($my_text);
Or for Markdown Extra:
require_once '/path/to/code/Michelf/MarkdownExtra.php';
$my_html = \Michelf\MarkdownExtra::defaultTransform($my_text);