Download the PHP package taylornetwork/name-formatter without Composer

On this page you can find all versions of the php package taylornetwork/name-formatter. 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 name-formatter

Name Formatter for Laravel

A customizable name formatter class for Laravel.

Install

Via Composer

Publish Config

This will add nameformatter.php to your config directory

Usage

Create a new instance of the class by passing it an instance of Illuminate\Eloquent\Model and call format()

Let's say we have a Customer model at App\Customer

We want to add a fullName attribute to our customer. We can create a getAttribute method Laravel will use to create the attribute for us. See Laravel Eloquent Documentation for more information.

Get the customer's full name

Returns

By default the Formatter class will concatenate the first_name attribute, a space and the last_name attribute.

Trait

This package includes a trait you can add to your model that will add a fullName attribute.

You can then access the full name using the default configuration by:

Override Formatter Config

You can override the formatter config when using the trait by overriding the formatterConfig method in your model

Available Methods

format ()

Returns formatted name.

map (string | array $field, string | null $modelField)

By default the Formatter class will look for a first_name and last_name attribute on the model it was passed. If the model you are passing it has different attribute names fot first and last names you can either pass an associative array to the map function or two strings.

For a model with a first name attribute named fName and a last name attribute named lName

style (string $style)

By default the Formatter class will format names as $first_name . ' ' . $last_name You can override the style with the style function. style accepts a string with the formatting you would like Formatter to use

Key Description Example: 'John Doe'
'F' The full first name 'John'
'L' The full last name 'Doe'
'f' The first initial 'J'
'l' The last initial 'D'

Any other characters in the string will appear in the formatted name

Examples

To get the first initial and last name

To get the last initial, the first name

To get the first and last initials

You can even add other characters to the style string

Every key in the string is replaced, so you could do something like this. (Though I don't know why you would)

Config

Once you run php artisan vendor:publish the config file nameformatter.php will be in your config directory. There you can set the defaults you want in terms of format style, field map, etc.

Credits

License

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


All versions of name-formatter with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
illuminate/support Version >=5.5
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 taylornetwork/name-formatter contains the following files

Loading the files please wait ....