sylae / word-count
PHP port of the Javascript iarna/word-count
Fund package maintenance!
Patreon
paypal.me/MisfitMaid
Requires
- php: >=7.2
- ext-intl: *
Requires (Dev)
- phpunit/phpunit: ^9.5.4
This package is auto-updated.
Last update: 2025-03-16 23:43:22 UTC
README
PHP port of iarna/word-count. This should provide an accurate wordcount taking into account apostrophes and hyphens and stuff. See iarna's project for disclaimers on what languages this method may not work well with.
Usage
composer require sylae/word-count
<?php use Sylae\Wordcount; $string = "This string has five words!"; $count = Wordcount::count($string); // int(5)
Contributing
I mean if you want to cool i guess <3
- PSR-2.
- Write tests.
- Yeet me a PR.
I'm lowkey pretty sure ::count()
could be improved with fancy regex magic, but I'm a dumb bitch so idk.
Versioning
semver.
License
MIT.