PHPackages                             zazza/creole - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. zazza/creole

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

zazza/creole
============

Creole Wiki parser for PHP extended from cebe/markdown

026PHP

Since Apr 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Zazza/creole)[ Packagist](https://packagist.org/packages/zazza/creole)[ RSS](/packages/zazza-creole/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

creole parser extended from cebe/markdown
=========================================

[](#creole-parser-extended-from-cebemarkdown)

[![Build Status](https://camo.githubusercontent.com/387fd8fb9a1c26448e50f04b72b4ad39c575ea3a58b7387704d886557161d5bf/68747470733a2f2f7472617669732d63692e6f72672f736f667461726b2f6372656f6c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/softark/creole)[![Code Coverage](https://camo.githubusercontent.com/81050215559c95552b10f858cda5ea7ddbe38339dc5181131e6d545529cc1707/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736f667461726b2f6372656f6c652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/softark/creole/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0af454686c687de5d1f0102681c3f19abd219864bce59e0f9770e7f9500e799c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736f667461726b2f6372656f6c652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/softark/creole/?branch=master)

What is this?
----------------------------------------------

[](#what-is-this-)

This is a [Creole Wiki](http://www.wikicreole.org/wiki/Creole1.0) parser for PHP built upon [cebe/markdown parser for PHP](https://github.com/cebe/markdown).

Installation
-----------------------------------------------------

[](#installation-)

[PHP 5.4 or higher](http://www.php.net/downloads.php) is required to use it. It will also run on facebook's [hhvm](http://hhvm.com/).

Installation is recommended to be done via [composer](https://getcomposer.org/ "The PHP package manager") by running:

```
composer require softark/creole "~1.2"

```

Alternatively you can add the following to the `require` section in your `composer.json` manually:

```
"softark/creole": "~1.2"
```

Run `composer update` afterwards.

Note that the installation automatically includes the dependent packages, especially "cebe/markdown", to make the creole parser functional.

Usage
---------------------------------------

[](#usage-)

The usage of the creole parser is similar to that of cebe/markdown parser.

### In your PHP project

[](#in-your-php-project)

To parse your wiki text you need only two lines of code. The first one is to create the creole parser instance:

```
$parser = new \softark\creole\Creole();

```

The next step is to call the `parse()`-method for parsing the text using the full wiki language or calling the `parseParagraph()`-method to parse only inline elements:

```
$parser = new \softark\creole\Creole();
$outputHtml = $parser->parse($wikiText);

// parse only inline elements (useful for one-line descriptions)
$parser = new \softark\creole\Creole();
$outputHtml = $parser->parseParagraph($wikiText);
```

You may optionally set the following option on the parser object:

- `$parser->html5 = true` to enable HTML5 output instead of HTML4.

And you should set the following properties when you are using the wiki style links, i.e. \[\[link\]\] for an internal link and \[\[WikiName:link\]\] for an external link:

- `$parser->wikiUrl = 'http://www.example.com/wiki/'` for the url of the current wiki.
- `$parser->externalWikis = ['Wiki-A' => 'http://www.wiki-a.com/', 'Wiki-B' => 'http://www.wiki-b.net/']`for the external wikis. It should be an array in which the keys are the name of the wiki and the value the urls of them.

It is recommended to use UTF-8 encoding for the input strings. Other encodings are currently not tested.

### Using raw html blocks

[](#using-raw-html-blocks)

In the version 1.2.0 and later, you may optionally include raw html blocks in the source wiki text, although this feature is disabled by default because it's not in the Creole 1.0 specification.

You can enable this feature by specifying the following option:

- `$parser->useRawHtml = true`

A raw html block should start with a line that only contains ``, for example:

```
>

```

Note that the output of the raw html blocks **SHOULD BE CLEANSED** with `$parser->rawHtmlFilter`. A recommendation is to use HTML Purifier for the filter. For example:

```
$parser->rawHtmlFilter = function($input) {
    $config = \HTMLPurifier_Config::createDefault();
    $purifier = \HTMLPurifier::getInstance($config);
    return $purifier->purify($input);
};

// Or, if you are Yii 2 user
$parser->rawHtmlFilter = function($input) {
    return \yii\helpers\HtmlPurifier::process($input);
};

```

As you see in the example, the `rawHtmlFilter` should be a callable that accepts the possibly unclean html text string and output the sanitized version of it.

### The command line script

[](#the-command-line-script)

You can use it to convert a wiki text to a html file:

```
bin/creole some.txt > some.html

```

Here is the full Help output you will see when running `bin/creole --help`:

```
PHP Creole to HTML converter
----------------------------

by Nobuo Kihara

Usage:
    bin/creole [--full] [file.txt]

    --full    ouput a full HTML page with head and body. If not given, only the parsed markdown will be output.

    --help    shows this usage information.

    If no file is specified input will be read from STDIN.

Examples:

    Render a file with original creole:

        bin/creole README.txt > README.html

Convert the original creole description to html using STDIN:

    curl http://www.wikicreole.org/attach/Creole1.0TestCases/creole1.0test.txt | $cmd > creole.html

```

Acknowledgements
------------------------------------------------

[](#acknowledgements-)

I'd like to thank [@cebe](https://github.com/cebe "Carsten Brandt") for creating [cebe/markdown](https://github.com/cebe/markdown "A super fast, highly extensible markdown parser for PHP") library on which this work depends.

As its name describes, cebe/markdown is a markdown parser, but is also a well designed general purpose markup language parser at the bottom on which you can implement parsers not only for different "flavors" of markdown but also for different markup languages, Creole for instance.

FAQ
-----------------------------------

[](#faq-)

### Where do I report bugs or rendering issues?

[](#where-do-i-report-bugs-or-rendering-issues)

Just [open an issue](https://github.com/softark/creole/issues/new) on github, post your creole code and describe the problem. You may also attach screenshots of the rendered HTML result to describe your problem.

### Am I free to use this?

[](#am-i-free-to-use-this)

This library is open source and licensed under the [MIT License](http://opensource.org/licenses/MIT). This means that you can do whatever you want with it as long as you mention my name and include the [license file](https://github.com/softark/creole/blob/master/LICENSE). Check the [license](https://github.com/softark/creole/blob/master/LICENSE) for details.

Contact
-------

[](#contact)

Feel free to contact me using [email](mailto:softark@gmail.com) or [twitter](https://twitter.com/softark).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f260a17585c03e83e7b8269354595bb08b67f53344ab9a94a17debfc05c017be?d=identicon)[Zazza](/maintainers/Zazza)

---

Top Contributors

[![softark](https://avatars.githubusercontent.com/u/342857?v=4)](https://github.com/softark "softark (11 commits)")[![Zazza](https://avatars.githubusercontent.com/u/722091?v=4)](https://github.com/Zazza "Zazza (4 commits)")

### Embed Badge

![Health badge](/badges/zazza-creole/health.svg)

```
[![Health](https://phpackages.com/badges/zazza-creole/health.svg)](https://phpackages.com/packages/zazza-creole)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
