Minimal PECL-style scaffold for a Snowball (libstemmer) extension with vendored sources.
From sources
pie install --with-snowball
From Packagist
pie install coral-media/php-snowball --with-snowball
Further info PIE official repository
phpize
./configure --with-snowball
make -j"$(nproc)"
make install
Check the releases page. Download the compatible asset with your PHP version and make sure you load the extension in php.ini.
Basic stemming (defaults to English + UTF_8):
<?php
echo snowball_stem('running'); // run
Explicit language + encoding:
<?php
echo snowball_stem('corriendo', SNOWBALL_LANG_ES, SNOWBALL_ENCODING_UTF_8); // corr
Batch stemming for arrays (more efficient than looping in PHP):
<?php
$words = ['running', 'jumps'];
print_r(snowball_stem_array($words)); // ['run', 'jump']
lib/libstemmer.'make' '-j10'" failed try --make-parallel-jobs 1. Same procedure with make -j if building from sources. Adjust to any convenient value.