marshmallow / address-prefiller
This package will get the full address information based on the zipcode and house number. Currently online dutch addresses are supported.
Installs: 5 110
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 9
Language:Vue
Requires
- php: >=7.1.0
- dev-main
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-dependabot/npm_and_yarn/minimist-1.2.8
- dev-dependabot/npm_and_yarn/json5-1.0.2
- dev-dependabot/npm_and_yarn/express-4.18.2
- dev-dependabot/npm_and_yarn/qs-and-express-6.11.0
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/minimatch-3.1.2
- dev-dependabot/npm_and_yarn/terser-4.8.1
- dev-dependabot/npm_and_yarn/async-2.6.4
- dev-dependabot/npm_and_yarn/follow-redirects-1.14.8
This package is auto-updated.
Last update: 2024-11-21 11:13:32 UTC
README
Nova Translatable
This package will prefill address field based on a provided zipcode and housenumber. This currently only supports Dutch addresses. This can be used in your custom applications or you can use it with Laravel Nova.
Installation
Installing the package via Composer
Install the package in a Laravel project via Composer.
# Install the package
composer require marshmallow/address-prefiller
Usage in Nova
There is a custom Laravel Nova field available which you can use. This works very simular to the Laravel Place field. The difference is that this field will not talk to Algolia but to the official open api provided by the dutch goverment which should contain all the latest information.
public function fields(Request $request) { return [ ID::make()->sortable(), $this->addressFields(), ]; } protected function addressFields() { return $this->merge([ Zipcode::make(__('Zipcode prefiller'), __('Zipcode'), __('Housenumber')) /** * Let the package know which columns are connected to * the fields. The default values are commented after each * function call. Is your column names match these defaults, * you don't need to call all these functions. */ ->zipcode('zipcode') ->housenumber('address_2') ->street('address_1') ->city('city') ->province('province') ->country('country') ->latitude('latitude') ->longitude('longitude'), /** * The field below will all be prefilled with the collected * data if we find a match on the submitted zipcode and housenumber. */ Hidden::make(__('Zipcode'), 'zipcode')->hideFromIndex(), Hidden::make(__('Housenumber'), 'address_2')->hideFromIndex(), Text::make(__('Street'), 'address_1')->hideFromIndex(), Text::make(__('City'), 'city')->hideFromIndex(), Text::make(__('Province'), 'province')->hideFromIndex(), Country::make(__('Country'), 'country')->hideFromIndex(), Text::make(__('Latitude'), 'latitude')->hideFromIndex(), Text::make(__('Longitude'), 'longitude')->hideFromIndex(), ]); }
Usage manualy
We have provided an example on how you can use this functionality in your own application. We've currently only used this in the Nova setting so if you're missing anything, please let us know!
use Marshmallow\Zipcode\Facades\Zipcode; return Zipcode::get( $request->zipcode, $request->housenumber );
Testing
composer test
Security
If you discover any security related issues, please email stef@marshmallow.dev instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.