定制 uhupi/php-oop-html-tag-element 二次开发

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

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

uhupi/php-oop-html-tag-element

Composer 安装命令:

composer require uhupi/php-oop-html-tag-element

包简介

A PHP utility class to create and manage HTML elements using OOP.

README 文档

README

Simple class to create Html Tags/Elements.

Create frontend even if you are backend Dev.

Is PHP really only Back-End now?

Bringing more redering to the client-side can sink your performance also loose pagespeed in your FMP and FCP. This is a usefull helper for all PHP Front-End and Back-End developers out there trying to bring their PHP code back to the Front again. It uses the basics of an OOP Programming in PHP to make your HTML layout managable, heritable and independent. (Componentwise or Snippet if you may)

Features

  • Manage all your Elements over namespaces, from simple HTML-Elements to complex constructions, call them and render them with a simple new class instance.
  • Do not break your PHP code and to embed inbeetween Html or JS. Create small snippets and print from one variable.
  • Manage globally you entire application using heritance, designing a layout that responses to any change.
  • Also if your apllication already runs on PHP you may have lots of resources (like Routing, locale, Translations...) that will not be available in the front and it gets very complicated to get them into an Javascript or frameworks like React.js or Vue.js.
  • Creating small components in PHP to be parsed by Javascript or any JS Framework allows to use you full PHP Potencial it will possible to write frontend code in PHP and use it on the clientside. More to that cooming soon...
  • Gut clean possiblity for Meaningful-Names and file documentation the way we all know it in PHP. In Beetween Modeling and

Requirements

PHP 7

Installation

  • PHP WebApp: Download and Copy Element.php to your project depending on your namespacing include the file into a namespaced file and create a class extending it.
  • WordPress: Include file to your Theme or any Plugin (Plugin and Explanation coming soon...)

Demo

<?php

// print a simple Link
$link = new Element('a', 'Click here');
$link->setAttr('href', '/');

echo $link;

// Or create your Link template
class Button extends Element {
    public function __construct($content = false, $url = false) {
        parent::__construct('a', $content, 'button');
        if ($url) {
            $this->setAttr('href', $url);
        }
        $this->setClass('button');
    }
}

// print adding your defined values like content and the url
$button = new Button('Click here', '/');
// or maybe you decide in the view or your template to add some content
if (TRUE) {
    $button->setContent(' NOW!');
}
echo $button;

// or Print it in one line if you like
echo new Button('Click here', '/');

License

PHP-OOP-HTML-Tag-Element is licensed under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固