PHPackages                             dangquangha/phpflashtext - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. dangquangha/phpflashtext

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

dangquangha/phpflashtext
========================

A port of the flashtext python implementation

019PHP

Since Aug 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dangquangha/phpflashtext)[ Packagist](https://packagist.org/packages/dangquangha/phpflashtext)[ RSS](/packages/dangquangha-phpflashtext/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Flashtext for PHP
=================

[](#flashtext-for-php)

[![Build Status](https://camo.githubusercontent.com/e74ba7ab487c8ea5239c58de179f5e042c27529d16575c8ca685d1c9849ca825/68747470733a2f2f7472617669732d63692e6f72672f73686465762f706870666c617368746578742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/shdev/phpflashtext) [![Coverage Status](https://camo.githubusercontent.com/96403673805fa12637ce4dea6644552a972e1f706a89ce298cd99d75fa4f5cba/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73686465762f706870666c617368746578742f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/shdev/phpflashtext?branch=master)

It's a port from the wonderful python project , for internals of the algorithm look there.

This algorithm allows you to extract or replace several keywords at ones. If you deal with 300 keywords, which have 5 variants each a regex approach is slower than the flashtext approach. For 1000 keyword with 5 variants each the regex can't be build.

In PHP 5.6 using regex is really slow. In newer verions it performs better.

Install
-------

[](#install)

```
composer require dangquangha/phpflashtext
```

Usage
-----

[](#usage)

```
