Download the PHP package x-laravel/fuzzy-similarity without Composer

On this page you can find all versions of the php package x-laravel/fuzzy-similarity. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fuzzy-similarity

Fuzzy Similarity

Tests PHP Laravel

Fuzzy (string-based) similarity for Laravel Eloquent models: compare two records, or rank a collection against a query, by how closely their text matches.

It measures how the text is written, not what it means. For meaning-based (vector) similarity see x-laravel/embedding; the two packages can be used on the same model side by side.

How It Works

Requirements

Installation

Optionally publish the config file:

Setup

A slot's columns are joined with a space; blank values are skipped. Override toFuzzyText(string $slot) to build the text yourself.

Usage

Compare two records

Rank a collection

The query may also be a model. Each ranked model gets a fuzzy_score attribute; ranking happens in PHP, so pass an already narrowed-down collection.

Compare strings directly

Algorithms

Key Behaviour
similar_text (default) PHP's similar_text() percentage, computed over characters instead of bytes. Gives the same result as the native function on ASCII input.
token_set Ignores word order and repeated words. A string whose words all appear in the other scores 100 (Acme Corporation vs Acme Corporation International).

Add your own by implementing XLaravel\FuzzySimilarity\Contracts\Algorithm and registering it under algorithms in the config, or pass its class name as algorithm:.

Normalizers

Class Behaviour
AsciiNormalizer (default) Transliterates to lower-case ASCII (é → e, ß → ss, ø → o), turns - _ . · and dashes into spaces, drops invisible characters (zero-width space, BOM, word joiner…), collapses whitespace.
LowercaseNormalizer Lower-cases and collapses whitespace only.

Set normalizer in the config to any class implementing XLaravel\FuzzySimilarity\Contracts\Normalizer.

AsciiNormalizer keeps the last 10,000 results in a per-process cache, so a name compared against thousands of candidates is folded once, and long-running processes (Octane, queue workers) reuse results across requests. When the cache is full the oldest entry is dropped. Call AsciiNormalizer::flushCache() to empty it.

Testing

License

MIT


All versions of fuzzy-similarity with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
ext-intl Version *
ext-mbstring Version *
illuminate/database Version ^12.0|^13.0
illuminate/support Version ^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package x-laravel/fuzzy-similarity contains the following files

Loading the files please wait ...