{"id":31908315,"url":"https://github.com/enzyme/name","last_synced_at":"2025-10-13T15:26:58.746Z","repository":{"id":56978271,"uuid":"47493231","full_name":"enzyme/name","owner":"enzyme","description":"Name manipulation library for PHP.","archived":false,"fork":false,"pushed_at":"2016-04-03T07:53:55.000Z","size":36,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-28T16:14:22.515Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enzyme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-06T11:01:06.000Z","updated_at":"2021-01-23T21:30:05.000Z","dependencies_parsed_at":"2022-08-21T11:20:57.873Z","dependency_job_id":null,"html_url":"https://github.com/enzyme/name","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/enzyme/name","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzyme%2Fname","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzyme%2Fname/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzyme%2Fname/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzyme%2Fname/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enzyme","download_url":"https://codeload.github.com/enzyme/name/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enzyme%2Fname/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279015919,"owners_count":26085778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T15:26:51.322Z","updated_at":"2025-10-13T15:26:58.734Z","avatar_url":"https://github.com/enzyme.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://cloud.githubusercontent.com/assets/2805249/11685005/7af1aa74-9ec1-11e5-924c-711068f7adde.png\" width=\"200\"\u003e\n\n[![Build Status](https://travis-ci.org/enzyme/name.svg?branch=master)](https://travis-ci.org/enzyme/name)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/enzyme/name/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/enzyme/name/?branch=master)\n[![Coverage Status](https://coveralls.io/repos/enzyme/name/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/enzyme/name?branch=master)\n\nName manipulation library for PHP.\n\n# What is it?\n\nIf your website accepts user data in the form of *First Name*, *Last Name* and optionally *Middle* and/or *Prefix (Dr., Mrs.)* and then you would like to format the data - this package is for you.\n\n# Installation\n\n```bash\ncomposer require enzyme/name\n```\n\n# Usage\n\n#### Standard first and last names.\n\n```php\nuse Enzyme\\Name\\Simple;\n\n$name = Simple::fromString('Hubert Cumberdale');\necho $name-\u003egetFirst(); // Hubert\necho $name-\u003egetLast(); // Cumberdale\n```\n\n#### Formatted first and last names.\n\n```php\nuse Enzyme\\Name\\Simple;\nuse Enzyme\\Name\\Format;\n\n$name = Simple::fromString('Hubert Cumberdale');\n$fmt = Format($name);\n\necho $fmt-\u003elike('First'); // Hubert\necho $fmt-\u003elike('First L.'); // Hubert C.\necho $fmt-\u003elike('Last, F.'); // Cumberdale, H.\n\n// Quickfire option.\necho Format::nameLike($name, 'First L.'); // Hubert C.\n```\n\n#### Formatted full names (with middle/prefix).\n\n```php\nuse Enzyme\\Name\\Simple;\nuse Enzyme\\Name\\Format;\n\n$name = Simple::fromString('Dr. Hubert Alberto Cumberdale');\n\necho Format::nameLike($name, 'First M. Last'); // Hubert A. Cumberdale\necho Format::nameLike($name, 'P. First M. Last'); // Dr. Hubert A. Cumberdale\necho Format::nameLike($name, 'P. Last, F. M.'); // Dr. Cumberdale, H. A.\n```\n\n# Name options\n\n`Simple` exposes the follow accessors which return `Part` instances.\n\n`$name-\u003egetPrefix();`\n`$name-\u003egetFirst();`\n`$name-\u003egetMiddle();`\n`$name-\u003egetLast();`\n\nEach `Part` has two options:\n\n`$part-\u003elong()` Returns the long version of the name, eg: Hubert\n`$part-\u003eshort()` Returns the short version of the name, eg: H.\n\nYou can build a new name in 3 ways:\n\n`Simple::fromString(...)` Simply pass in a string and it will 'intelligently' try and parse the name out from it.\n\n`Simple::fromArgs(...)` Simply pass in arguments and it will try and build the full name from them. The name is build based on the number of arguments passed in, so 1 argument equals to the `first` name, 2 -\u003e `first last`, 3 -\u003e `first middle last` and 4 -\u003e `prefix first middle last`.\n\nSo to create the name `Hubert Cumberdale` using the `fromArgs` constructor, it would look like `Simple::fromArgs('Hubert', 'Cumberdale');`.\n\nThe last option give you the most control, `Simple::strict()`. It simply returns a new `Simple` object which you then explicitly build up using the setters: `$simple-\u003eprefix(...);`, `$simple-\u003efirst(...);`, `$simple-\u003emiddle(...);` and `$simple-\u003elast(...);`. Each setter can be optionally called to build names of different configurations.\n\n# Formatter Options\n\nThe following examples use the name `Mr. Hubert Alfred Smith Cumberdale`\n\nMarker | Returned Name\n-------|--------------\nPrefix | Mr.\nP.     | Mr.\nFirst  | Hubert\nF.     | H.\nLast   | Cumberdale\nL.     | C.\nMiddle | Alfred Smith\nM.     | A. S.\n\nAny other character will be left untouched. So for example you can create the name `Cumberdale, H. A. S.` from the following format string `Last, F. M.`\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenzyme%2Fname","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenzyme%2Fname","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenzyme%2Fname/lists"}