PHPackages                             yomo/addressfactory - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yomo/addressfactory

Abandoned → [https://github.com/nonsapiens/realaddressfactory](/?search=https%3A%2F%2Fgithub.com%2Fnonsapiens%2Frealaddressfactory)Library[Utility &amp; Helpers](/categories/utility)

yomo/addressfactory
===================

Creates real-world street addresses from Google Maps, to use in database seeding, unit tests, or anything else. Supports Laravel 5+, and Faker

1.0.8(7y ago)413.7k10[1 PRs](https://github.com/nonsapiens/addressfactory/pulls)MITPHPPHP &gt;=7.0.0CI failing

Since Oct 29Pushed 3y ago2 watchersCompare

[ Source](https://github.com/nonsapiens/addressfactory)[ Packagist](https://packagist.org/packages/yomo/addressfactory)[ Docs](https://github.com/nonsapiens/addressfactory)[ RSS](/packages/yomo-addressfactory/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (5)Versions (15)Used By (0)

**NOTE:** *This package is for legacy Laravel only! Please use the newer [RealAddressFactory](https://github.com/nonsapiens/realaddressfactory) for more recent Laravel versions!*

RealAddress Generator
=====================

[](#realaddress-generator)

About
-----

[](#about)

This Laravel 5 library creates actual, 100% real addresses, with full address details and lat/long coordinates Using the Google Maps API, these addresses can be created using the RealAddress classes, and also supports Faker, so you can use RealAddress in your database seeding!

Installation
------------

[](#installation)

Require this package with composer using the following command:

```
composer require yomo/addressfactory
```

### Laravel 7 or higher

[](#laravel-7-or-higher)

Please use the updated package, [RealAddressFactory](https://github.com/nonsapiens/realaddressfactory). This specific package is for legacy Laravel only!

### Laravel 5.5 or higher

[](#laravel-55-or-higher)

Execute:

```
php artisan vendor:publish --tag=yomo.realaddress

```

### Laravel 5.4 or lower

[](#laravel-54-or-lower)

If you are running Laravel 5.4 and below, you need to add the service provider to the `providers` array in `config/app.php`

```
Yomo\AddressFactory\AddressFactoryServiceProvider::class
```

Then execute:

```
php artisan vendor:publish --tag=yomo.realaddress
```

### Google Maps API

[](#google-maps-api)

As this library relies on Google Maps, your Google Maps API key needs to be defined in your `.env` file:

```
GOOGLE_MAPS_API_KEY=abcdefghijklmnopqrstuv

```

If you don't have an API key (they're free), [get one here](https://developers.google.com/maps/documentation/javascript/get-api-key)

Usage
-----

[](#usage)

RealAddress offers three different ways of generating real-world addresses. [Each of these methods return the `\Geocoder\Provider\GoogleMaps\Model\GoogleAddress` class](http://geocoder-php.org/Geocoder/), which takes the Google Maps API response and standardises it in an easy-to-use, easy-to-read manner. As standard, RealAddress supports the generating of real addresses for the following countries:

- United States of America
- Great Britain
- France
- Germany
- South Africa
- Russia

You can extend RealAddress by adding additional countries in the `config/realaddress.php` config file. This config file also defines which cities in a given country addresses can be created for. Additional cities can be defined here.

### Faker

[](#faker)

RealAddress provides additional functions for Faker's `\Faker\Generator` class instance. The code example below shows typical usage in a Factory class:

```
use Faker\Generator as Faker;

$factory->define( \App\Models\Business::class, function ( Faker $faker ) {

	/** @var \Geocoder\Provider\GoogleMaps\Model\GoogleAddress $address */
	$address = $faker->britishAddress();

	return [

		'title'              => $faker->words(2),
		'full_address'       => $address->getFormattedAddress(),
		'latitude'           => $address->getCoordinates()->getLatitude(),
		'longitude'          => $address->getCoordinates()->getLongitude()

	];

} );
```

Similarly, the address can be limited to a specific city: `$address = $faker->britishAddress('London');`

or can be generated randomly between multiple-defined cities: `$address = $faker->britishAddress(['London', 'Manchester']);`

... where these cities must be defined in `config/realaddress.php` in order to work.

The ready-to-use faker functions include:

- `britishAddress()`
- `usaAddress()`
- `germanAddress()`
- `frenchAddress()`
- `southAfricanAddress()`
- `russianAddress()`

If you have extended `config/realaddress.php` to include a new country, you can generate an address for it with:

```
	$address = $faker->realAddress('Brazil')						# From any of the defined cities
	$address = $faker->realAddress('Brazil', 'Rio de Janiero');		# For Rio de Janiero only
	$address = $faker->realAddresss('Brazil', ['Rio de Janiero', 'Salvador'])	# Multiple cities
```

### Using the Facade

[](#using-the-facade)

Using the Facade allows you to generate real-world addresses at runtime, and also allows *multiple* addresses to be generated at once. The code examples below show typical RealAddress facade usage:

```
use Yomo\AddressFactory\Facades\RealAddress;
.
.
.
$johannesburgAddresses 	= RealAddress::makeSouthAfrica(20, 'Johannesburg');		# 20 addresses for Johannesburg, South Africa
$frenchAddress 			= RealAddress::makeFrance(1);							# A single address for France
$brazilAddresses		= RealAddress::make(10, 'Brazil');						# 10 addresses for the custom country of Brazil
```

### Using the RealAddress class

[](#using-the-realaddress-class)

Functionally, provides the same methods as the Facade above:

```
$f = new \Yomo\AddressFactory\RealAddress();

$southAfricanPoints = $f->makeSouthAfrica(4);                # Generates 4 locations within South Africa's major cities
$capeTownPoints     = $f->makeSouthAfrica(2, 'Cape Town');   # Generates 2 locations from Cape Town, South Africa
$multiPoints        = $f->makeSouthAfrica(3, ['Pretoria', 'Johannesburg']);
```

### Adding new countries or cities

[](#adding-new-countries-or-cities)

An example of extending the `config/realaddress.php` array to include Kenya, and two cities:

```
'kenya' => [
		'cities' => [ 'Nairobi', 'Mombasa' ],
	],
```

Note that the cities defined here must be identifiable to Google Maps, and should ideally be spelt in their English variant.

About the author
----------------

[](#about-the-author)

[**Stuart Steedman**](https://www.linkedin.com/in/stuart-steedman-b612a537/) is the head of development at [Yonder Media](http://www.yonder.co.za), a South African digital media agency operating out of Pretoria. He specialises in PHP and Laravel development, and is a speaker at tech and development related conferences.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 70.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~52 days

Total

13

Last Release

2754d ago

Major Versions

0.1.2 → 1.0.02018-03-30

PHP version history (3 changes)0.0.1PHP ~5.6|~7.0

1.0.0PHP ~7.0

1.0.2PHP &gt;=7.0.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d8b2540548fd4037017a3177a24b230506c67ca96d5ed870cd82153726e597f?d=identicon)[nonsapiens](/maintainers/nonsapiens)

---

Top Contributors

[![nonsapiens](https://avatars.githubusercontent.com/u/9744534?v=4)](https://github.com/nonsapiens "nonsapiens (17 commits)")[![stuartsteedman](https://avatars.githubusercontent.com/u/69784087?v=4)](https://github.com/stuartsteedman "stuartsteedman (5 commits)")[![keepanitreel](https://avatars.githubusercontent.com/u/1206265?v=4)](https://github.com/keepanitreel "keepanitreel (2 commits)")

---

Tags

AddressFactoryYomo

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/yomo-addressfactory/health.svg)

```
[![Health](https://phpackages.com/badges/yomo-addressfactory/health.svg)](https://phpackages.com/packages/yomo-addressfactory)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M686](/packages/barryvdh-laravel-ide-helper)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M861](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)[nonsapiens/realaddressfactory

Creates real-world street addresses from Google Maps, to use in database seeding, unit tests, or anything else. Supports Laravel 11+, and Faker

4910.2k7](/packages/nonsapiens-realaddressfactory)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
