Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Markup.php

PHP port of Markup.js

The test suite has also been ported, with some changes to take into account differences between PHP and JavaScript. Specifically:

  • PHP has no equivalent of undefined
  • PHP can not call methods on primitives (like strings, ints)

In general, JavaScript's behavior is maintained, for example true + " " + false in JS evaluates to "true false", whereas in PHP it would evaluate to "1 ".

Requires (at least) PHP 5.4.

To use:

<?php
require('Mark.php');
use Markup\Mark;
$context = [
	'name' => [ 'first' => 'John', 'last' => 'Doe' ],
];
$template = "{{name.last}}, {{name.first}}";
$result = Mark::up($template, $context);
?>

About

PHP port of Markup.js

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages