This package provides a simple way to extract hashtags from a string in any language.
You can install the package via composer:
composer require piscibus/php-hashtag
We invest a lot of resources into creating open source projects. This package is extracted from a bigger project. We are using it in production, and we will continue to maintain it. If you find it useful, please consider supporting us. All kinds of contributions are welcome.
use Piscibus\PhpHashtag\Extractor;
$text = 'This is an #English #text with #hashtags';
$hashtags = Extractor::extract($text); // ['English', 'text', 'hashtags']
// Or you can use the helper function
$hashtags = extract_hashtags($text); // ['English', 'text', 'hashtags']
This package is open-sourced software licensed under the MIT license.