uffe-code / word-count
PHP port of the Javascript iarna/word-count
1.0.0
2024-04-08 13:01 UTC
Requires
- php: >=8.2
- ext-intl: *
Requires (Dev)
- phpunit/phpunit: ^11.1.1
This package is auto-updated.
Last update: 2025-04-08 15:19:50 UTC
README
PHP port of sylae/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 uffe-code/word-count
<?php use UffeCode\Wordcount; $string = "This string has five words!"; $count = Wordcount::count($string); // int(5)
Contributing
- PSR-4.
- Write tests.
- Create a PR.
License
MIT