Download the PHP package nonsapiens/realaddressfactory without Composer

On this page you can find all versions of the php package nonsapiens/realaddressfactory. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package realaddressfactory

RealAddress Generator

About

This Laravel 8+ 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

Require this package with composer using the following command:

Google Maps API

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

If you don't have an API key, get one here

Usage

RealAddress offers three different ways of generating real-world addresses. Each of these methods return the \Geocoder\Provider\GoogleMaps\Model\GoogleAddress class, 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:

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

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

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:

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

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:

Using the RealAddress class

Functionally, provides the same methods as the Facade above:

Adding new countries or cities

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

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

Warning

Extended and heavy use of this factory may cause Google to block your key. Heavy use may also attract GCP API charges, subject to Google's Places API costing structure. To help prevent this, there is a built in rate-limiter, that blocks too many calls being made to the Google API. This value is configurable inside the config/realaddress.php config file

About the author

Stuart Steedman is CTO of YONDER, a GroupM/WPP South African digital media agency operating out of Bryanston. He specialises in PHP and Laravel development, and is a speaker at tech and development related conferences.

Jonathan Maurer is a senior developer at YONDER, a GroupM/WPP South African digital media agency operating out of Pretoria. He specialises in PHP and Laravel development.


All versions of realaddressfactory with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3.0
fakerphp/faker Version ^1.13
illuminate/support Version >=8.0
laravel/framework Version >=8.0
toin0u/geocoder-laravel Version ^4.4
willdurand/geocoder Version ^4.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nonsapiens/realaddressfactory contains the following files

Loading the files please wait ....