waynestate / formy-parser
解析字符串以获取formy元素,并将字符串转换为HTML表单
1.0.5
2022-03-21 20:30 UTC
Requires
- php: >=5.5.0
- waynestate/string-middleware: ~1.1.1
Requires (Dev)
- phpunit/phpunit: ~4.5
This package is auto-updated.
Last update: 2024-09-22 01:41:30 UTC
README
解析字符串以获取formy元素,并将字符串转换为HTML表单 编辑添加主题
安装
composer require waynestate/formy-parser
使用方法
<?php
use Waynestate\FormyParser\Parser;
use Waynestate\ParserMiddleware\ParserMiddleware;
// Composer autoload
require __DIR__ . '/../vendor/autoload.php';
// Create the instance of the Parser Middleware
$parser = new ParserMiddleware;
// Set the stack of parsers to run
$parser->setStack([
'Waynestate\FormyParser\Parser'
]);
// Original String we want to parse
$string = '<p>Content before embed.</p><p>[form id="undergrad"]</p><p>Content after embed.</p>';
// Generate the html form
$html_form = $parser->parse($string);
// Display the form with content surrounding it
echo $html_form;
测试
phpunit
代码覆盖率
phpunit --coverage-html ./coverage