Skip to content

Commit e573ce3

Browse files
authored
Update README.md
1 parent f601bf6 commit e573ce3

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Generate initials from names
2+
23
This is the core of [LasseRafn/php-initial-avatar-generator](http://github.com/LasseRafn/php-initial-avatar-generator), or well.. the initials generation part of it.
34

45
It's framework agnostic, which is different from basically everything else I do, you're welcome.
@@ -15,13 +16,16 @@ Supports UTF8 (yes, also emojis.)
1516
</p>
1617

1718
## Installation
19+
1820
You just require using composer and you're good to go!
1921
```bash
2022
composer require lasserafn/php-initials
2123
```
2224

2325
## Usage
26+
2427
As with installation, usage is quite simple. Generating a image is done by running:
28+
2529
```php
2630
use LasseRafn\Initials\Initials;
2731

@@ -33,16 +37,40 @@ echo (new Initials)->length(1)->generate('Camilla'); // Output:
3337
echo (new Initials)->name('Jens Ølsted')->getUrlfriendlyInitials(); // Output: JO
3438
```
3539

36-
## Supported methods and parameters
37-
### Name (initials) - default: JD
40+
All you'll have to do is either pass in the name in the constructor like so:
41+
42+
```php
43+
echo new Initials('The Name Here'); // TH
44+
```
45+
46+
or use the `name($name)` method, to specify the name.
47+
48+
49+
## Supported methods
50+
51+
### name($name = 'John Doe')
52+
3853
```php
3954
$initials->name('Albert Magnum')->generate();
4055
```
4156

42-
### Length - default: 2
57+
### length($length = 2)
58+
4359
```php
4460
$initials->name('Albert Magnum')->length(3)->generate();
4561
```
4662

63+
### generate()
64+
65+
This method will output the initials. It's completely optional, you could also just echo out the class as it has a `__toString()` method.
66+
67+
```php
68+
$initials->name('Albert Magnum')->generate();
69+
```
70+
71+
### getUrlfriendlyInitials()
72+
73+
Will output url-friendly initials (stripping characters like ÆØÅ)
74+
4775
## Requirements
4876
* PHP 5.6, 7.0 or 7.1

0 commit comments

Comments
 (0)