Skip to content

Commit f3f6b29

Browse files
committed
Additional README updates
1 parent 5fed9fd commit f3f6b29

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,40 @@ First, import Twine:
4646
use PHLAK\Twine;
4747
```
4848

49-
Then instantiate a Twine string:
49+
Then instantiate a Twine object by newing up a `Twine\Str` object and passing
50+
your string as the first parameter.
5051

5152
```php
5253
$string = new Twine\Str('john pinkerton');
54+
```
5355

54-
// or statically via the make() method
56+
You may also instantiate a `Twine\Str` object statically via the `make()` method.
5557

58+
```php
5659
$string = Twine\Str::make('john pinkerton');
60+
```
5761

58-
// or with the str() helper method
62+
Or use the global `str()` helper method. The method takes a string as the only
63+
parameter and returns a `Twine\Str` object.
5964

65+
```php
6066
$string = str('john pinkerton');
6167
```
6268

63-
More details available at <https://twine.phlak.net/docs/usage/>
69+
Once you have a concrete `Twine\Str` instance you may treat it like any other
70+
string. This includes echoing it or using any of PHPs built in string functions
71+
against it.
72+
73+
```php
74+
echo $string; // Echos 'john pinkerton'
75+
76+
str_shuffle($string) // Returns something like 'enoipo ktnjhnr'
77+
78+
strlen($string); // Returns 14
79+
```
80+
81+
At this point you're ready to start using Twine by calling any of it's many
82+
built in methods.
6483

6584
Available Methods
6685
-----------------
@@ -148,8 +167,6 @@ Available Methods
148167
[wrapHard](https://twine.phlak.net/docs/methods/wraphard)
149168
[wrapSoft](https://twine.phlak.net/docs/methods/wrapsoft)
150169

151-
Full documentation available at <https://twine.phlak.net>
152-
153170
---
154171

155172
Method Chaining
@@ -174,6 +191,8 @@ $string = new Twine\Str(file_get_contents('garbage.bin'));
174191
$string->base64()->wrap(76, "\r\n", Twine\Config\Wrap::HARD);
175192
```
176193

194+
Additional details available in the full documentation at <https://twine.phlak.net>.
195+
177196
Changelog
178197
---------
179198

0 commit comments

Comments
 (0)