Download the PHP package plin-code/laravel-full-name without Composer

On this page you can find all versions of the php package plin-code/laravel-full-name. 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 laravel-full-name

Laravel Full Name

Laravel Fullname

Packagist PHP from Packagist Laravel versions GitHub Workflow Status (main) Total Downloads

Search and sort Eloquent queries (and Filament tables) by a person's full name stored across two columns (first_name and last_name), either on the main model or on a BelongsTo / HasOne relation.

What it solves

Filament's built-in ->searchable(['first_name', 'last_name']) searches each column independently, which fails for composite queries like "mario rossi". The native ->sortable(query: ...) works for direct columns but requires repetitive custom join logic for relation-based sort. This package encapsulates the solution once, tested once, documented once.

Installation

No config file, no migrations, no Blade views, no Artisan command. The service provider auto-registers.

Requirements

Quick start

Standalone Eloquent

Filament, direct columns

Filament, via BelongsTo

Filament, via HasOne

Custom column names

The complete API surface lives in docs/api.md.

Performance considerations

The matching strategy uses LOWER(CONCAT(COALESCE(first, ''), ' ', COALESCE(last, ''))) which prevents btree indexes from being used on first_name or last_name. On tables up to a few hundred thousand rows this is typically acceptable for admin panel search. For very large tables, pair this package with a dedicated search engine (Meilisearch, Scout, Algolia) and use this package only for sort.

Matching behavior

The core uses LOWER(CONCAT(COALESCE(first, ''), ' ', COALESCE(last, ''))) matched with LIKE ? ESCAPE '!' in both forward and reversed concatenation forms.

Query Record Matches
mario first_name='Mario', last_name='Rossi' yes
rossi first_name='Mario', last_name='Rossi' yes
mario rossi first_name='Mario', last_name='Rossi' yes
rossi mario first_name='Mario', last_name='Rossi' yes
maria first_name='Marianna', last_name='Rossi' yes (substring, single token)
maria rossi first_name='Marianna', last_name='Rossi' no (multi token)
marianna rossi first_name='Marianna', last_name='Rossi' yes
mario giovanni rossi first_name='Mario Giovanni', last_name='Rossi' yes
rossi mario giovanni first_name='Mario Giovanni', last_name='Rossi' yes
bianchi mario first_name='Mario', last_name='Rossi Bianchi' yes

The asymmetry between single token and multi token queries is intentional and emerges from the SQL pattern. Single token queries use substring match, so maria matches records containing maria anywhere in either column. Multi token queries require the tokens to appear contiguously with the separating space between them in the concatenated first last or last first form, so maria rossi matches Maria Rossi but not Marianna Rossi (the separator space is not present between maria and rossi in the concatenation). Single token queries are exploratory (the user may be typing a prefix), multi token queries target a specific person.

See docs/conventions.md for the rationale behind the naming split between the Eloquent and Filament layers.

Limitations

  1. Only the BelongsTo and HasOne relation types are supported. HasMany, BelongsToMany, MorphTo, and nested relations raise UnsupportedRelationException at query build time.
  2. Accent and diacritic normalization is delegated to the database collation. On MySQL, use utf8mb4_unicode_ci or utf8mb4_0900_ai_ci. On PostgreSQL, consider the unaccent extension if needed.
  3. Fuzzy matching (soundex, metaphone, Levenshtein, trigram) is out of scope.
  4. Single column full name (one name column) is not handled. Filament's native ->searchable(['name']) covers that case already.
  5. Empty or whitespace only search input leaves the query unchanged (no WHERE clause is added).
  6. When combining orderByFullName(relation: ...) with an explicit ->select([...]) on the main query, qualify the column names with the main table name (for example ->select(['test_bookings.id']) rather than ->select(['id'])). The package performs a joinSub under the hood, which can introduce ambiguity for unqualified columns that exist on both tables.

Testing

Contributing

Please see CONTRIBUTING for details.

Changelog

Please see CHANGELOG for recent changes.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-full-name with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
illuminate/database Version ^12.0 || ^13.0
illuminate/support Version ^12.0 || ^13.0
spatie/laravel-package-tools Version ^1.16
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 plin-code/laravel-full-name contains the following files

Loading the files please wait ...