A Laravel seeder for all Belgian cities + postal codes

Published on Sep 11, 2014

Just the other day I needed a quick seeder to populate a table in my Laravel project with Belgian postal codes. A quick search gave me all the data in XLS or XML format that would have been easy to import into MySQL, but I really wanted the data to be seeded through Laravel instead. That way, it's much easier to push the seeder to git and migrate all tables on a server or other machine in the future.

I thought it could be useful to other developers in Belgium as well, so here you go, a simple Laravel seeder for Belgian postal/zip codes, together with the city name and province it belongs to.

1 - Get the code on Github

https://github.com/iamgoodbytes/laravel-seeder-belgian-cities

2 - Run artisan

Run artisan migrate:refresh --seed to re-run all your migrations and seed the tables. If all goes well you will now have a table with all Belgian cities and their zip codes.

Belgian Postal Codes

3 - Troubleshooting

I can't think of much that can go wrong here, but if for some reason the seeder doesn't work for you, make sure you run composer dump-autoload to update the list of classes to load in order to include the seeder class. If it still fails, get in touch with me and I'll see what I can do! Keep on coding!

No comments? But that’s like a Gin & Tonic without the ice?

I’ve removed the comments but you can shoot me a message on LinkedIn to keep the conversation going.