PHPackages                             laragrad/str-trgm - 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. laragrad/str-trgm

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

laragrad/str-trgm
=================

v1.1.0(2y ago)099MITPHPPHP ^7.1|^8.0

Since Jun 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/laragrad/str-trgm)[ Packagist](https://packagist.org/packages/laragrad/str-trgm)[ RSS](/packages/laragrad-str-trgm/feed)WikiDiscussions master Synced today

READMEChangelog (3)DependenciesVersions (4)Used By (0)

laragrad/str-trgm
=================

[](#laragradstr-trgm)

A package to compare two string with trigramm algorithm like as PostgreSql pg\_trgm package similarity() function.

Installing
----------

[](#installing)

Run command in console

```
composer require laragrad/str-trgm

```

Functions
---------

[](#functions)

All functions are static.

### similarity()

[](#similarity)

Return similarity value (0..1) for two strings.

Syntax:

`similarity(string $text1, string $text2) : float`

Arguments:

- **$text1** - First word or sentense
- **$text2** - Second word or sentense

Returns a value of similarity in range from 0 to 1.

getSentenceTrgms
----------------

[](#getsentencetrgms)

Returns an array of trigramms for sentense.

Syntax:

`getSentenceTrgms(string $text) : array`

Arguments:

- **$text** - Sentense string

Returns an array of trigramms.

getWordTrgms
------------

[](#getwordtrgms)

Returns an array of trigramms for word.

Syntax:

`getWordTrgms(string $text) : array`

Arguments:

- **$text** - Word string

Returns array of trigramms.

normalizeSentense()
-------------------

[](#normalizesentense)

Function normalizes a string.

- convert string to lower case,
- replace any symbols by space,
- replace double spaces by single space.

Syntax:

`normalizeSentence(string $text) : string`

Arguments:

- **$text** - Source string

Returns normalized string.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~557 days

Total

3

Last Release

1030d ago

PHP version history (2 changes)v1.0.0PHP ^7.2.0

v1.0.1PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c6e39b12f90ad3357a5559e15f2bd1bec5dce02f90a88a898b28abe397084bfd?d=identicon)[laragrad](/maintainers/laragrad)

---

Top Contributors

[![laragrad](https://avatars.githubusercontent.com/u/65588602?v=4)](https://github.com/laragrad "laragrad (2 commits)")

---

Tags

laravelhelperpostgres

### Embed Badge

![Health badge](/badges/laragrad-str-trgm/health.svg)

```
[![Health](https://phpackages.com/badges/laragrad-str-trgm/health.svg)](https://phpackages.com/packages/laragrad-str-trgm)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M683](/packages/barryvdh-laravel-ide-helper)[cartalyst/support

Support helpers.

762.8M14](/packages/cartalyst-support)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
