PHPackages                             dustinwilson/texturize - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. dustinwilson/texturize

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dustinwilson/texturize
======================

Translates ASCII punctuation characters into typographically-correct punctuation

0.5.1(4y ago)013MITPHPPHP &gt;=8.0.2

Since Jan 31Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dustinwilson/Texturize)[ Packagist](https://packagist.org/packages/dustinwilson/texturize)[ RSS](/packages/dustinwilson-texturize/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Texturize
=========

[](#texturize)

Translates -- "texturizes" -- ASCII punctuation characters into typographically-correct punctuation. Based loosely off of an ancient Wordpress method used for the same purpose. The major difference with this library is that this library can translate strings in complex markup and within attributes.

Warning Before Using
--------------------

[](#warning-before-using)

I have used this code in various forms for more than 10 years, but I am releasing it initially as "beta" software because there are no tests. Writing tests for this will be superficial, but I have to have time to do it.

Requirements
------------

[](#requirements)

- PHP 8.0.2 or newer with the following extensions:
    - [dom](https://www.php.net/manual/en/book.dom.php) extension
- Composer 2.0 or newer

Documentation
-------------

[](#documentation)

Texturize is a single static class.

### dW\\Texturize

[](#dwtexturize)

```
class dW\Texturize {
    // Flags for toggling features
    public static bool $curlyQuotes = true;
    public static bool $dashes = true;
    public static bool $ellipses = true;

    // Text nodes which are descendants of these elements won't be selected for
    // texturization
    public static array $ignoredAncestors = [ 'code', 'command', 'kbd', 'keygen', 'pre', 'samp', 'script', 'style', 'tt', 'var' ];

    // Attributes which should be texturized
    public static array $includedAttributes = [ '@alt', '@aria-label', 'meta[not(@name="viewport")]/@content', '@longdesc', '@rel', '@rev', '@title' ];

    public static function withString(string $data): string;
    public static function withDOM(\DOMDocument|\DOMElement &$node): \DOMDocument|\DOMElement;
}
```

#### Properties

[](#properties)

- *curlyQuotes* (bool): If true, texturizes curly quotes (eg: "" to “”).
- *dashes* (bool): If true, texturizes dashes (eg: -- to –).
- *ellipses* (bool): If true, texturizes ellipses (eg: ... to …).
- *ignoredAncestors* (array): An array of element names whose text node descendants will be ignored.
- *includedAttributes* (array): An array of XPath snippets corresponding to attributes that should be texturized.

#### dW\\Texturize::withString

[](#dwtexturizewithstring)

"Texturizes" a given string.

```
public static function withString(string $data): string;
```

- `data`: The string to "texturize"

#### dW\\Texturize::withDOM

[](#dwtexturizewithdom)

"Texturizes" a given `\DOMDocument` or `\DOMElement`. It is aware of adjacent elements and will successfully translate complex DOM structures.

```
public static function withDOM(\DOMDocument|\DOMElement &$node): \DOMDocument|\DOMElement;
```

- `node`: The `\DOMDocument` or `\DOMElement` to texturize.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

1561d ago

### Community

Maintainers

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

---

Top Contributors

[![dustinwilson](https://avatars.githubusercontent.com/u/1885928?v=4)](https://github.com/dustinwilson "dustinwilson (6 commits)")

### Embed Badge

![Health badge](/badges/dustinwilson-texturize/health.svg)

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

###  Alternatives

[mgallegos/laravel-jqgrid

Laravel jqGrid package allows you to easily integrate the popular jQuery Grid Plugin (jqGrid) into your Laravel application.

7115.5k1](/packages/mgallegos-laravel-jqgrid)[lifeonscreen/nova-sort-relations

This package improves support for sorting relations in Laravel Nova.

2081.9k](/packages/lifeonscreen-nova-sort-relations)

PHPackages © 2026

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