3f/converter
最新稳定版本:1.5
Composer 安装命令:
composer require 3f/converter
包简介
A set of classes to translate a text from HTML to BBcode and from BBCode to Markdown.
README 文档
README
Converter
A set of classes to translate a text from HTML to BBCode and from BBCode to Markdown.
The HTML to BBCode converter, in particular, has not been created with the intent to convert an entire HTML page, but just to convert a set of HTML tags used to format articles and blog posts in the HTML era, when Markdown and BBcode didn't exist at all.
The special BBCode to Markdown converter is able to convert: bold, italic, underline and strikethrough texts, lists, urls, images, quotes and even code blocks (snippets).
Composer Installation
To install Converter, you first need to install Composer, a Package Manager for PHP, following these few steps:
curl -s https://getcomposer.org/installer | php
You can run this command to easily access composer from anywhere on your system:
sudo mv composer.phar /usr/local/bin/composer
Converter Installation
Once you have installed Composer, it's easy install Converter.
- Edit your
composer.jsonfile, adding Converter to the require section:
{
"require": {
"3f/converter": "dev-master"
},
}
- Run the following command in your project root dir:
composer update
Usage
There are two classes: HTMLConverter and BBCodeConverter. The first class may be used to convert from HTML to
BBCode, while the second one is used to convert from BBCode to Markdown.
HTML to BBCode conversion:
$converter = new Converter\HTMLConverter($text, $id); echo $converter->toBBCode();
BBCode to Markdown conversion:
$converter = new Converter\BBCodeConverter($text, $id); echo $converter->toMarkdown();
In both cases the $id is optional. When provided is used in case an exception is raised during the conversion process.
Documentation
The documentation can be generated using Doxygen. A Doxyfile is provided for your convenience.
Requirements
- PHP 5.4.0 or above.
Authors
Filippo F. Fadda - filippo.fadda@programmazione.it - http://www.linkedin.com/in/filippofadda
License
Converter is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.
统计信息
- 总下载量: 144.44k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 29
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2013-08-06