You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-3Lines changed: 31 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,5 @@
1
1
# Generate initials from names
2
+
2
3
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.
3
4
4
5
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.)
15
16
</p>
16
17
17
18
## Installation
19
+
18
20
You just require using composer and you're good to go!
19
21
```bash
20
22
composer require lasserafn/php-initials
21
23
```
22
24
23
25
## Usage
26
+
24
27
As with installation, usage is quite simple. Generating a image is done by running:
28
+
25
29
```php
26
30
use LasseRafn\Initials\Initials;
27
31
@@ -33,16 +37,40 @@ echo (new Initials)->length(1)->generate('Camilla'); // Output:
33
37
echo (new Initials)->name('Jens Ølsted')->getUrlfriendlyInitials(); // Output: JO
34
38
```
35
39
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.
0 commit comments