phy/markup 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phy/markup

Composer 安装命令:

composer require phy/markup

包简介

Dynamic HTML builder, nothing super worth while. It does supports default HTML3, HTML4, HTML5, and XHTML tags.

README 文档

README

PHY\Markup gives you a nice little HTML builder. You can append/prepend elements to your main HTML element and they'll all render out on echo.

Uses a little black magic with a few __call and __get methods but they do make it nicer on the eyes.

Usage

<?php

use PHY\Markup\HTML5 as Markup;

/*
 * Create an article tag with a class of "article".
 */
$markup = new Markup;
$article = $markup->article;
$article->class('article');

/*
 * Use our HTML helper to create some elements for us.
 */
$helper = $markup->helper();
$url = $helper->url('Our Link\'s title!', [
    '/rest.php',
    'key' => 'value'
]);

/*
 * Add some extra content to our article.
 */
$article
    ->append($markup->header($markup->h2('H2 Heading!'),['class' => 'header'))
    ->append($markup->section($markup->p('Inner P tag!')))
    ->append($markup->footer->append($url));

/*
 * Recursively generate our HTML on echo.
 * Produces: <article class="article"><header class="header"><h2>H2 Heading!</h2></header><section><p>Inner P tag!</p></section><footer><a href="/rest.php?key=value">Our Link's Title!</a></footer></article>
 */
echo $article;

/*
 * Also, you can use the Markup::create('HTML5');
 */
use \PHY\Markup;
$markup = Markup::create('HTML5');

/*
 * Now for some example usage of using the Markup class itself.
 */
var_dump($markup->isTagVoid('br'));
var_dump($markup->has('div'));

$markup->add('banana', [], true);
$markup->has('banana');
var_dump($markup->isTagVoid('banana'));

$markup->remove('canvas', 'height');
var_dump($markup->has('canvas', 'height'));

$markup->remove('video');
var_dump($markup->has('video'));

About

Created this so I could dynamically create HTML blocks and link them together without having to worry about creating the actual HTML strings until it was time to push it to the server. Found it very helpful to create anchor tags as well as dynamic lists this way.

Requirements

  • PHP 5.4+

Submitting bugs and feature requests

Please send bugs to me via GitHub

Author

John Mullanaphy - john@jo.mu - http://jo.mu/ That's it for now...

License

PHY\Markup is licensed under the DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - see the LICENSE file for details

Acknowledgements

This library was based on an old perl HTML builder I used many eons ago. I liked it then so I wanted to continue it's sexiness in PHP.

TODO

  • Finish writing tests for this.
  • Finish my other projects that utilize this class.
  • Add some more documentation and examples.
  • Maybe buff up the Factory class a bit.

统计信息

  • 总下载量: 44
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: DO
  • 更新时间: 2013-08-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固