Skip to content

Commit dc3951f

Browse files
Update readme
1 parent 8a98f25 commit dc3951f

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

README.md

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
[![Tests](https://img.shields.io/github/actions/workflow/status/stfndamjanovic/php-random-string/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/stfndamjanovic/php-random-string/actions/workflows/run-tests.yml)
44

5-
This package can be used to generate a random string based on your set of characters or predefined ones.
6-
You can configure string length, prefix, suffix, count of strings, or to skip some strings under certain conditions...
5+
This package can be used to generate a random string based on your set of characters or predefined ones. You can configure string length, prefix, suffix, and count of strings, or skip some strings under certain conditions...
76

87
## Installation
98

@@ -23,15 +22,17 @@ $string = RandomString::new()->generate(); // Output: RIKdjFzuDaN12RiJ
2322
```
2423

2524
### Length definition
26-
You can control the length of string. By default, it's 16 characters length.
25+
26+
You can control the length of the string. By default, it's 16 characters.
2727

2828
```php
2929
$string = RandomString::new(6)->generate(); // Output: dzGcot
3030
````
3131

3232
### Predefined charset
3333

34-
If you want to generate string consist of numbers only, lower case letters or uppercase letters you can use predefined charsets.
34+
If you want to generate a string consisting of numbers only, lowercase letters, or uppercase letters you can use predefined charsets.
35+
3536
```php
3637
// Generate string that contains only numbers
3738
$config = StringConfig::make()
@@ -65,7 +66,7 @@ $string = RandomString::fromConfig($config)->generate(); // Output: 3B41B32C2A12
6566

6667
### Skipping
6768

68-
Sometimes you may want to generate random string, but under certain conditions.
69+
Sometimes you may want to generate a random string but under certain conditions.
6970
For example, give me a string that is not part of this array.
7071

7172
```php
@@ -81,7 +82,7 @@ $string = RandomString::fromConfig($config)->generate(); // Output: 083712
8182

8283
### Prefix and Suffix
8384

84-
If you want to add prefix or suffix to generated string, you can do it like this.
85+
If you want to add a prefix or suffix to generated string, you can do it like this.
8586

8687
```php
8788
use Stfn\RandomString\StringConfig;
@@ -96,7 +97,7 @@ $string = RandomString::fromConfig($config)->generate(); // Output: PRE_rkM7Jl_A
9697

9798
### Array of random strings
9899

99-
RandomString can generate more than just one string.
100+
`RandomString` can generate more than just one string.
100101

101102
```php
102103
$config = StringConfig::make()
@@ -123,17 +124,12 @@ $strings = RandomString::fromConfig($config)->generate();
123124
// Output: ["92ONRj", "Me6oym", "WbBPVc"];
124125
```
125126

126-
### Shorthands
127+
### Everything in one line
127128

128-
You can use shorthands if you don't want to create 2 objects every time.
129+
You can use the `fromArray` method if you don't want to create 2 objects every time.
129130

130131
```php
131-
$string = RandomString::fromArray([
132-
'length' => 6,
133-
'charset' => 'ABCD1234'
134-
])->generate();
135-
136-
echo $string; // Output: CCDA1D
132+
$string = RandomString::fromArray(['length' => 6, 'charset' => 'ABCD1234'])->generate(); // Output: CCDA1D
137133
```
138134

139135
## Testing
@@ -144,7 +140,7 @@ composer test
144140

145141
## Security
146142

147-
While the RandomString class is designed to generate random and unpredictable string, it is important to note that it is not a cryptographically secure hash function and should not be used for sensitive applications such as password hashing or cryptographic key generation.
143+
While the `RandomString` class is designed to generate random and unpredictable string, it is important to note that it is not a cryptographically secure hash function and should not be used for sensitive applications such as password hashing or cryptographic key generation.
148144

149145
## Changelog
150146

0 commit comments

Comments
 (0)