A framework agnostic driver-based content rendering package, with support for HTML, Markdown & plain text.
You can register custom drivers for custom content types.
As you pass content to interpret, it will determine what it is and allow you to extract it's normal value and HTML equivalent.
The package requires PHP 5.3+ and comes bundled with a Laravel 4 and a Service Provider to simplify the optional framework integration and follows the FIG standard PSR-4 to ensure a high level of interoperability between shared PHP code and is fully unit-tested.
composer.json and add the following to the
Note: Make sure that after the required changes your
composer.jsonfile is valid by running
Install the dependencies
Run Composer to install or update the new requirement.
Note: We're assuming you have Composer installed Globally.
Now you are able to require the
vendor/autoload.php file to autoload the package.
Cartalyst packages are framework agnostic and as such can be integrated easily natively or with your favorite framework.
The Interpret package has optional support for Laravel 4 and it comes bundled with a Service Provider and a Facade for easy integration.
After installing the package, open your Laravel config file located at
app/config/app.php and add the following lines.
$providers array add the following service provider for this package.
$aliases array add the following facade for this package.
'Interpreter' => 'Cartalyst\Interpret\Facades\Interpreter',
Integrating the package outside of a framework is incredible easy, just follow the example below.
// Include the composer autoload file require_once 'vendor/autoload.php'; // Import the necessary classes use Cartalyst\Interpret\Interpreter; // Instantiate the interpreter $interpreter = new Interpreter;
The integration is done and you can now use all the available methods, here's an example:
// Convert from markdown to html echo $interpreter->make('## Hello', 'md')->toHtml();
In this section we'll show you how to use the interpret package.
Convert Markdown to HTML
$content = Interpreter::make('# Hello', 'md')->toHtml();