Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Name Parser

Name Parser Laravel Package

theiconic/name-parser

PHP library for parsing human names into structured parts. Handles titles, first/middle/last names, initials, prefixes/suffixes, and common edge cases, making it easier to normalize, store, and display names consistently in your apps.

Deep Wiki
Context7

theiconic/name-parser is a PHP utility for reliably splitting human names into structured parts. It applies sensible heuristics to handle real‑world naming conventions, helping you normalize user input for CRM, checkout, or profile data without reinventing parsing rules.

Use it to convert a free‑form name string into consistent components like title, first name, middle name, last name, and suffix, while accounting for common edge cases.

  • Parses names into structured fields (prefix/title, given, middle, family, suffix)
  • Handles multi‑part surnames and common particles (e.g. “van”, “de”)
  • Supports initials and abbreviated forms
  • Includes datasets for common honorifics/suffixes to improve accuracy
  • Lightweight, framework‑agnostic, easy to integrate in Laravel or any PHP app
Frequently asked questions about Name Parser
How do I install theiconic/name-parser in a Laravel project?
Run `composer require theiconic/name-parser` in your project directory. The package is Composer-aware and will auto-load via Laravel’s autoloader. No additional configuration is needed for basic usage.
Does this package support Laravel 10+ and PHP 8.1+?
Yes, theiconic/name-parser is compatible with Laravel 10.x and PHP 8.1+. It has no Laravel-specific dependencies, so it works as a standalone library in any Laravel-compatible environment.
Can I parse names in multiple languages (e.g., Arabic, Chinese, Cyrillic) with this?
Absolutely. The package is designed to be language-independent, handling Unicode characters and non-Latin scripts seamlessly. It avoids hardcoding language rules, making it versatile for global applications.
How accurate is the name parsing compared to dedicated libraries like NameParser or Parsley?
theiconic/name-parser prioritizes universality over rigid rules, so it may not match the precision of niche libraries for specific languages. However, it excels in edge cases (e.g., hyphenated names, titles) where other tools fail.
What’s the best way to test name parsing in a Laravel test suite?
Use Laravel’s PHPUnit with assertions for parsed components (e.g., `assertEquals('John', $parser->getFirstName('John Doe'))`). Test edge cases like Unicode names, titles (Dr., Prof.), and ambiguous formats.
Will this work in production for high-traffic applications?
Yes, the library is lightweight and stateless, making it efficient for production. Benchmark with your expected load, but it’s optimized for low memory usage and fast execution.
Can I customize the parsing rules (e.g., prioritize last names for certain cultures)?
The package doesn’t expose rule customization directly, as it relies on probabilistic parsing. For tailored behavior, extend the core logic or pre-process names before parsing.
Are there alternatives if I need strict validation (e.g., US Social Security rules)?
For strict validation, consider specialized libraries like `league/address` (for addresses) or `egulias/email-validator`. theiconic/name-parser focuses on parsing, not validation.
How do I handle false positives (e.g., 'Mac' as a first name vs. surname) in parsed results?
The parser uses context-aware heuristics, but ambiguous cases may require post-processing. Combine results with business logic (e.g., database checks) to resolve conflicts.
Is there documentation or examples for Laravel-specific integrations (e.g., Form Requests)?
The package is framework-agnostic, but you can integrate it into Laravel Form Requests by instantiating the parser in the `rules()` method. Check the GitHub repo (if available) for usage snippets.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport