Minimal PECL-style scaffold for a Snowball (libstemmer) extension with vendored sources.
From sources
pie install --with-snowballFrom Packagist
pie install coral-media/php-snowball --with-snowballFurther info PIE official repository
phpize
./configure --with-snowball
make -j"$(nproc)"
make installCheck 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'); // runExplicit language + encoding:
<?php
echo snowball_stem('corriendo', SNOWBALL_LANG_ES, SNOWBALL_ENCODING_UTF_8); // corrBatch stemming for arrays (more efficient than looping in PHP):
<?php
$words = ['running', 'jumps'];
print_r(snowball_stem_array($words)); // ['run', 'jump']- Generated API docs
- Official Snowball Website
- Vendored libstemmer sources live under
lib/libstemmer. - If PIE install or building from source fails with
'make' '-j10'" failedtry--make-parallel-jobs 1. Same procedure withmake -jif building from sources. Adjust to any convenient value.