PHPackages                             netcarver/textile - 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. [PDF &amp; Document Generation](/categories/documents)
4. /
5. netcarver/textile

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

netcarver/textile
=================

Textile markup language parser

v4.1.4(4mo ago)2311.5M—10%44[20 issues](https://github.com/textile/php-textile/issues)[1 PRs](https://github.com/textile/php-textile/pulls)16BSD-3-ClausePHPPHP &gt;=5.3.0CI passing

Since Dec 12Pushed 4mo ago27 watchersCompare

[ Source](https://github.com/textile/php-textile)[ Packagist](https://packagist.org/packages/netcarver/textile)[ Docs](https://github.com/textile/php-textile)[ RSS](/packages/netcarver-textile/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (48)Used By (16)Security (1)

PHP-Textile
===========

[](#php-textile)

[Textile reference](https://textile-lang.com/) | [Live editor](https://textile-lang.com/doc)

[![](https://camo.githubusercontent.com/4ccfab1a97e9eec23c2671fea82cfe42d5d1d703dea6151622ec519d870d0b94/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d74657874696c655f7068702d74657874696c65266d65747269633d636f766572616765)](https://sonarcloud.io/summary/overall?id=textile_php-textile) [![](https://camo.githubusercontent.com/491e7d8a19955fb44079fa1f9889b5ebd29a712588ec9c83f255201a94e9ee5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e65746361727665722f74657874696c652e737667)](https://packagist.org/packages/netcarver/textile) [![](https://camo.githubusercontent.com/0b3cdd8538e0aab1ecdd0880a6f0cdb698b6964a62e2f27caeccc51c5f22fa1b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e65746361727665722f74657874696c652e737667)](https://packagist.org/packages/netcarver/textile)

PHP-Textile is a modern Textile markup language parser for PHP. Textile is a humane web text generator that takes lightweight, readable, plaintext-like markup language and converts it into well formed HTML.

Install
-------

[](#install)

Using [Composer](https://getcomposer.org/):

```
$ composer require netcarver/textile
```

Usage
-----

[](#usage)

The Textile parser can be accessed through the `Netcarver\Textile\Parser` class. The class is highly configurable, and actual parsing happens with the `parse` method:

```
require './vendor/autoload.php';
$parser = new \Netcarver\Textile\Parser();
echo $parser->parse('h1. Hello World!');
```

### Parsing untrusted input

[](#parsing-untrusted-input)

If you are using PHP-Textile to format user-supplied input, blog comments for instance, remember to enable restricted parser mode:

```
$parser = new \Netcarver\Textile\Parser();
echo $parser
    ->setRestricted(true)
    ->parse('!bad/image/not/allowed.svg!');
```

In restricted mode PHP-Textile doesn’t allow more powerful formatting options such as inline styles, and removes any raw HTML.

### Parsing single-line fields

[](#parsing-single-line-fields)

If you are using PHP-Textile as a field-level formatter to parse just inline spans and glyphs, use the `setBlockTags` method to disable block tags:

```
$parser = new \Netcarver\Textile\Parser();
echo $parser
    ->setBlockTags(false)
    ->parse('Hello *strong* world!');
```

The above outputs:

```
Hello strong world!
```

### Doctypes

[](#doctypes)

Currently, PHP-Textile can target either XHTML or HTML5 output with XHTML being the default for backward compatibility. The targeted doctype can be changed via the `setDocumentType` method:

```
$parser = new \Netcarver\Textile\Parser();
echo $parser
    ->setDocumentType('html5')
    ->parse('HTML(HyperText Markup Language)');
```

### Setting alternate glyphs

[](#setting-alternate-glyphs)

Textile’s typographic substitutions can be overridden with the `setSymbol` method. If you need to setup Textile to do non-standard substitutions, call `setSymbol` before you parse the input with `parse`.

```
$parser = new \Netcarver\Textile\Parser();
$parser
    ->setSymbol('half', '1&#8260;2')
    ->parse('Hello [1/2] World!');
```

The symbol names you can pass to `setSymbol` can be found [here](https://github.com/textile/php-textile/blob/v3.6.1/src/Netcarver/Textile/Parser.php#L710).

### Prefixing relative image and link paths

[](#prefixing-relative-image-and-link-paths)

Setting prefix might be useful if you want to point relative paths to certain consistent location:

```
$parser = new \Netcarver\Textile\Parser();
$parser
    ->setImagePrefix('/user/uploads')
    ->setLinkPrefix('/')
    ->parse('!image.jpg! "link":page');
```

Getting in contact
------------------

[](#getting-in-contact)

The PHP-Textile project welcomes constructive input and bug reports from users. Please [open an issue](https://github.com/textile/php-textile/issues) on the repository for a comment, feature request or bug.

Development
-----------

[](#development)

See [CONTRIBUTING.textile](https://github.com/textile/php-textile/blob/master/.github/CONTRIBUTING.textile).

###  Health Score

62

—

FairBetter than 99% of packages

Maintenance71

Regular maintenance activity

Popularity58

Moderate usage in the ecosystem

Community35

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 84.5% 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.

###  Release Activity

Cadence

Every ~132 days

Recently: every ~179 days

Total

37

Last Release

149d ago

Major Versions

v2.5.3 → v3.5.32013-10-30

v2.5.4 → v3.5.42013-11-05

2.4.x-dev → v3.5.52014-01-02

v2.5.5 → v3.7.02018-12-15

3.8.x-dev → v4.0.02022-12-03

PHP version history (3 changes)v3.5.0PHP &gt;=5.3.0

2.4.x-devPHP &gt;=4.4.9

v2.5.5PHP &gt;=5.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/195e00de7595ea632bddf1085518154b7ee7254ec185b981d8f7407e096d9157?d=identicon)[netcarver](/maintainers/netcarver)

---

Top Contributors

[![gocom](https://avatars.githubusercontent.com/u/665186?v=4)](https://github.com/gocom "gocom (191 commits)")[![netcarver](https://avatars.githubusercontent.com/u/16049?v=4)](https://github.com/netcarver "netcarver (20 commits)")[![philwareham](https://avatars.githubusercontent.com/u/413665?v=4)](https://github.com/philwareham "philwareham (8 commits)")[![petecooper](https://avatars.githubusercontent.com/u/226578?v=4)](https://github.com/petecooper "petecooper (3 commits)")[![marcus-at-localhost](https://avatars.githubusercontent.com/u/1337223?v=4)](https://github.com/marcus-at-localhost "marcus-at-localhost (1 commits)")[![jools-r](https://avatars.githubusercontent.com/u/1203899?v=4)](https://github.com/jools-r "jools-r (1 commits)")[![jsoo](https://avatars.githubusercontent.com/u/92437?v=4)](https://github.com/jsoo "jsoo (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

composer-packagesformattermarkup-languageparserphptextilelanguageparserhtmlformatmarkupdocumenttextileplaintextphp-textile

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/netcarver-textile/health.svg)

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

###  Alternatives

[faisalman/simple-excel-php

Easily parse / convert / write between Microsoft Excel XML / CSV / TSV / HTML / JSON / etc formats

582599.4k1](/packages/faisalman-simple-excel-php)[s9e/text-formatter

Multi-purpose text formatting and markup library. Plugins offer support for BBCodes, Markdown, emoticons, HTML, embedding third-party media (YouTube, etc...), enhanced typography and more.

2413.1M29](/packages/s9e-text-formatter)[tecnickcom/tc-lib-pdf-parser

PHP library to parse PDF documents

4092.8k](/packages/tecnickcom-tc-lib-pdf-parser)[doctrine/rst-parser

PHP library to parse reStructuredText documents and generate HTML or LaTeX documents.

64233.6k9](/packages/doctrine-rst-parser)[scannerjs/scanner.js

ScannerJS: JavaScript web scan JPG PDF images from TWAIN WIA scanners in browser (Chrome, Edge, Firefox or IE)

5914.3k](/packages/scannerjs-scannerjs)

PHPackages © 2026

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