定制 mouf/html.htmlelement 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

mouf/html.htmlelement

最新稳定版本:v2.0.1

Composer 安装命令:

composer require mouf/html.htmlelement

包简介

This package contains the HtmlElementInterface interface that can be used to output HTML on a page. It also features base classes implementing this interface.

README 文档

README

This package contains an interface used to render objects in HTML. Basically, instances of classes implementing this interface provide a toHtml method that can be used to get some HTML.

The concept is very abstract, but also very powerful. Let's take a sample:

  • you might write a "HtmlButtonElement" class that would render a simple HTML button.
  • you might write a "HtmlCalendarElement" class that would render a calendar.
  • you might write a "HtmlTemplateElement" class that would render a full template.
  • ...

Obviously, this package is useless on its own. It is useful only if you implement the interface in your classes.

In practice

Implementing the HtmlElementInterface is simple stupid: just add a "toHtml" method to your code:

/**
 * Renders the object in HTML.
 * The Html is echoed directly into the output.
 */
function toHtml();

Provided classes

This package comes with a few classes implementing the HtmlElementInterface:

  • HtmlString: this class contains a string that is outputed when you call the toHtml method
  • HtmlFromFile: this class refers to a PHP file that is required when you call the toHtml method
  • HtmlFromFunction: this class refers to a PHP callable (method, function, ...) that is called when you call the toHtml method

Mouf package

This package is part of Mouf, an effort to ensure good developing practices by providing a graphical dependency injection framework.

统计信息

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

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2012-08-23