The enflow/laravel-address
package provides a opinionated way on how to implement address fields with autocomplete.
You can install the package via composer:
composer require enflow/laravel-address
You must publish the config to set the driver you which to use.
Pushing the config file:
php artisan vendor:publish --provider="Enflow\Address\AddressServiceProvider" --tag="config"
You must specify your driver choice. We provide a driver for HERE out of the box. See the 'Driver' section how to obtain a API key.
Pushing the migration file:
php artisan vendor:publish --provider="Enflow\Address\AddressServiceProvider" --tag="migrations"
The Address
model is provided free to use, and you are able to configure it just like a normal Eloquent relationship:
Schema::table('companies', function (Blueprint $table) {
// ...
$table->foreignId('address_id')->constrained();
});
<?php
use Enflow\Address\Models\Address;
use Illuminate\Database\Eloquent\Model;
class Company extends Model
{
public function address()
{
return $this->belongsTo(Address::class);
}
}
We highly recommend the use of our @enflow/laravel-address-ui
frontend package. This package adds the ability to add a autocomplete option to your address input for the end-user to easily select their address.
For installation instructions, see https://github.com/enflow-nl/laravel-address-ui
We support the following drivers out of the box. This may be extended in the future, and we welcome PRs for new drivers.
HERE Geocoding and Search provides a fast and easy to use autosuggestion option. We recomend this option due it's relative low cost and ease of use, without additional legal terms.
Product page: https://developer.here.com/products/geocoding-and-search
Pricing: https://developer.here.com/pricing
You may obtain a API token by registrating for an account.
Google Places isn't support out of the box and is something we want to support in the future. PRs are welcome!
Mapbox isn't support out of the box and is something we want to support in the future. PRs are welcome!
$ composer test
Please see CONTRIBUTING for details.
If you discover any security related issues, please email michel@enflow.nl instead of using the issue tracker.
Enflow is a digital creative agency based in Alphen aan den Rijn, Netherlands. We specialize in developing web applications, mobile applications and websites. You can find more info on our website.
The MIT License (MIT). Please see License File for more information.