Skip to content

HTML-based template for PHP syntax inspired by Vue.

License

Notifications You must be signed in to change notification settings

xPaw/php-vue-template

Repository files navigation

This is an unfinished PHP templating system which takes inspiration from Vue.

Attribute values, directives, and text interpolation accept PHP expressions.

For example:

<div v-if="$type === 'B'">
	some white space {{ $test }}
</div>
<p :id="$type" v-else>
	something else
</p>

<ul>
	<li v-for="$array as $value">
		{{ $value }}
	</li>
</ul>

compiles to:

<?php if ($type === 'B') { ?>
	<div>
		some white space <?php { echo \htmlspecialchars($test, \ENT_QUOTES|\ENT_SUBSTITUTE|\ENT_DISALLOWED|\ENT_HTML5, 'UTF-8'); } ?>
	</div>
<?php } else { ?>
	<p id="<?php echo \htmlspecialchars($type, \ENT_QUOTES|\ENT_SUBSTITUTE|\ENT_DISALLOWED|\ENT_HTML5, 'UTF-8'); ?>">
		something else
	</p>
<?php } ?>

<ul>
	<?php foreach ($array as $value) { ?>
		<li><?php { echo \htmlspecialchars($value, \ENT_QUOTES|\ENT_SUBSTITUTE|\ENT_DISALLOWED|\ENT_HTML5, 'UTF-8'); } ?></li>
	<?php } ?>
</ul>

About

HTML-based template for PHP syntax inspired by Vue.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published