basecamp/
name_of_person
g4t.io

Intelligent Parsing and Formatting of Names in PHP Applications

18 views 812 stars by Paul Redmond

Presenting names of people in full, familiar, abbreviated, and initialized forms (but without titulation etc)

README from basecamp/name_of_person Open on GitHub →

Name of Person

Presenting names for English-language applications where a basic model of first and last name(s) combined is sufficient. This approach is not meant to cover all possible naming cases, deal with other languages, or even titulations. Just the basics.

Examples

# Relies on Person having a schema with first_name and last_name columns.
class Person < ApplicationRecord
  has_person_name
end

# Saves a new record using { first_name: "David", last_name: "Heinemeier Hansson" }
person = Person.create! name: "David Heinemeier Hansson"

person.name.full        # => "David Heinemeier Hansson"
person.name.first       # => "David"
person.name.last        # => "Heinemeier Hansson"
person.name.initials    # => "DHH"
person.name.familiar    # => "David H."
person.name.abbreviated # => "D. Heinemeier Hansson"
person.name.sorted      # => "Heinemeier Hansson, David"
person.name.mentionable # => "davidh"
person.name.possessive  # => "David Heinemeier Hansson's"
person.name.possessive(:first)  # => "David's"
person.name.possessive(:last)  # => "Hansson's"
person.name.possessive(:initials)  # => "DHH's"
person.name.possessive(:sorted)  # => "Heinemeier Hansson, David's"
person.name.possessive(:abbreviated)  # => "D. Heinemeier Hansson's"


# Use directly
name = NameOfPerson::PersonName.full("David Heinemeier Hansson")
name.first # => "David"

Installation

# Gemfile
gem 'name_of_person'

If you are using this outside of Rails, make sure ActiveRecord and/or ActiveModel are manually required.

require 'active_record'
# and/or
require 'active_model'

No further development is going to happen

This gem is essentially frozen, as the developers have decided to only deal with full names going forward in their applications. Feel free to fork this work, brand it under a new name, and continue development.

License

Name of Person is released under the MIT License.

More from the ecosystem

durable-workflow/
workflow
g4t.io
9 1,292

Durable Workflow: Long-Running Workflows for Laravel

Embedded durable workflow runtime and orchestration engine for Laravel applications.

durable-workflow/workflow via Laravel News
packstub/
session-replay
g4t.io
14 52

Session Replay for Laravel: Self-Hosted Browser Recordings

Session replay for Laravel: record what a person did in the browser with rrweb, keep the recording on your own disk and database, and watch it behind a gate you define — masked inputs by default, errors, failed Livewire requests and web vitals marked on the timeline, a link to the replay in every log line. packstub/filament-session-replay adds the sessions to a Filament panel.

packstub/session-replay via Laravel News
cyberwizard-dev/
schedule-catchup
g4t.io
17

Replay Missed Laravel Scheduled Tasks With Schedule Catchup

Schedule Catchup replays missed Laravel scheduled tasks after downtime, with opt-in recovery, bounded retries, and access to the original scheduled date.

cyberwizard-dev/schedule-catchup via Laravel News