定制 roelofjan-elsinga/content-to-html-parser 二次开发

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

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

roelofjan-elsinga/content-to-html-parser

Composer 安装命令:

composer require roelofjan-elsinga/content-to-html-parser

包简介

This package converts content from strings or files to HTML strings to be rendered on a page

README 文档

README

Build status StyleCI Status Code coverage Total Downloads Latest Stable Version License

This package converts content from strings or files to HTML strings to be rendered on a page.

Installation

You can include this package through Composer using:

composer require roelofjan-elsinga/content-to-html-parser

Usage

use ContentParser\ContentParser;

$parser = ContentParser::forFile('/absolute/path/to/file.txt');

// OR

$parse_string = 'This is some beautiful text';

$parser = ContentParser::forString($parse_string, 'txt');

print $parser->parse(); // This is an HTML string

Available parsers

There are currently three parsers included:

  • HTML to HTML: This doesn't modify the string
  • Markdown to HTML: This parses Markdown to HTML strings
  • TXT to HTML: This parses plain text to usable HTML markup through nl2br()

Available methods

This package comes with two named constructors:

  • public static function forFile(string $file_path): ContentParserInterface
  • public static function forString(string $file_contents, string $file_extension = null): ContentParserInterface

You can parse the strings and get the resulting HTML string by calling: public function parse(): string

If you want to get the underlying parser, you can use: public function getParser(): ContentParserInterface

Testing

You can run the included tests by running ./vendor/bin/phpunit in your terminal.

Contributions

If you want to contribute you can add additional ContentParsers or improve the current parsers.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固