PHPackages                             masakielastic/striter - 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. masakielastic/striter

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

masakielastic/striter
=====================

PHP extension for string iteration with grapheme, codepoint, and byte modes

0.1.0(4mo ago)01CPHP &gt;=8.1

Since Feb 24Pushed 3mo agoCompare

[ Source](https://github.com/masakielastic/php-ext-striter)[ Packagist](https://packagist.org/packages/masakielastic/striter)[ RSS](/packages/masakielastic-striter/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

PHP String Iterator Extension
=============================

[](#php-string-iterator-extension)

A PHP extension that provides advanced string iteration capabilities for UTF-8 strings with support for grapheme clusters, Unicode codepoints, and byte-level iteration.

Features
--------

[](#features)

- **Grapheme Cluster Iteration**: Iterate over grapheme clusters (user-perceived characters) using PCRE2
- **Unicode Codepoint Iteration**: Iterate over individual Unicode codepoints
- **Byte-level Iteration**: Iterate over individual bytes for low-level string processing
- **UTF-8 Safe**: Proper handling of multibyte UTF-8 characters
- **Standard PHP Interfaces**: Implements Iterator, IteratorAggregate, and Countable interfaces for seamless integration

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

[](#installation)

### Requirements

[](#requirements)

- PHP 8.1 or higher
- PCRE2 library (libpcre2-dev)

### Using PIE (Recommended)

[](#using-pie-recommended)

[PIE](https://github.com/php/pie) (PHP Installer for Extensions) is the recommended way to install this extension.

```
# Install PIE if you haven't already
composer global require php/pie

# Install the extension
pie install masakielastic/striter
```

PIE automatically handles building and enabling the extension.

### Build from Source

[](#build-from-source)

```
# Install dependencies (Ubuntu/Debian)
sudo apt-get install libpcre2-dev

# Build extension
cd ext
phpize
./configure --enable-striter
make
sudo make install
```

### Enable Extension

[](#enable-extension)

Add to your php.ini:

```
extension=striter.so
```

Usage
-----

[](#usage)

### Basic Usage

[](#basic-usage)

```
