Skip to content

Commit 5faa98c

Browse files
authored
Added docs for retrieving outward and inward codes
1 parent d32bf03 commit 5faa98c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This library handles various UK postcode related tasks.
77
* Address lookup by postcode
88
* Postcode validation
99
* Generate valid UK postcodes
10+
* Get a postcode's outward and inward codes
1011

1112
## Installation
1213

@@ -71,3 +72,12 @@ This library allows you generate a random, validate, UK postcode. This makes use
7172
```php
7273
$postcode = \RapidWeb\Postcodes\Utils\Generator::generatePostcode();
7374
```
75+
76+
### Get outward and inward codes
77+
78+
> The first part of the Postcode eg PO1 is called the outward code as it identifies the town or district to which the letter is to be sent for further sorting. The second part of the postcode eg 1EB is called the inward code.
79+
80+
```php
81+
$outwardCode = \RapidWeb\Postcodes\Utils\Tokenizer::outward('ST163JR'); // Returns ST16
82+
$inwardCode = \RapidWeb\Postcodes\Utils\Tokenizer::outward('ST163JR'); // Returns 3JR
83+
```

0 commit comments

Comments
 (0)