承接 buttress/phpx-compile 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

buttress/phpx-compile

最新稳定版本:v0.2

Composer 安装命令:

composer require buttress/phpx-compile

包简介

Compiler for PHPX

README 文档

README

<PHPX compile="true"/>

An experimental compiler for PHPX

PHPX Compile compiles PHPX into more optimized PHP significantly reducing function calls when rendering PHPX files. With the example used in tests we see about a 6x speed improvement over plain PHPX

Compiled PHPX files are still plain PHP and can be swapped out for existing templates.

Warning

This project is experimental and has not been proven. Expect PHPX Compile to not always produce working output.

<?php

$x = new Buttress\Phpx\Phpx();
$github = 'https://github.com/buttress/phpx';

return $x->render(
    $x->div(class: 'content', c: [
        $x->h1(id: 'title', c: 'Hello World!'),
        $x->p(c: [
            'Brought to you by ',
            $x->a(href: $github, c: 'PHPX')
        ]),
    ])
);

becomes

<?php
$x = new Buttress\Phpx\Phpx();
$github = 'https://github.com/buttress/phpx';
return '<div class="content"><h1 id="title">Hello World!</h1>'.'<p>Brought to you by '.'<a href="'.htmlspecialchars($github, 50).'">PHPX</a>'.'</p>'.'</div>';

Installation

To install PHPX Compile, use composer:

composer require buttress/phpx-compile

Usage

/** Basic Usage */

$parser = (new \PhpParser\ParserFactory())->createForHostVersion();
$compiler = new \Buttress\Compiler($parser);

$phpxVariable = 'x'; // The variable name I use in my phpx files.
$input = file_get_contents('/my_file_that_uses_phpx');
$php = $compiler->compile($input, $phpxVariable);

Related Projects

  • PHPX A fluent DOMDocument wrapper that makes it easy to write safe valid HTML in plain PHP.
  • PHPX Templates An experimental template engine built around PHPX and PHPX Compile.

Contributing

Contributions to PHPX Compile are always welcome! Feel free to fork the repository and submit a pull request.

License

PHPX is released under the MIT License.

Githooks

To add our githooks and run tests before commit:

git config --local core.hooksPath .githooks

Support

If you encounter any problems or have any questions, please open an issue on GitHub.

Thanks for checking out PHPX Compile ❤️

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固