Download the PHP package nevadskiy/laravel-geonames without Composer

On this page you can find all versions of the php package nevadskiy/laravel-geonames. 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 laravel-geonames

🌎 Populate your database using the GeoNames service

PHPUnit Code Coverage Latest Stable Version License

Stand With Ukraine

🗒️ Description

The package is useful for applications that rely on the geo data.

By default, it provides 4 models: Continent, Country, Division, City and translations for them.

The translations are powered by the nevadskiy/laravel-translatable package.

The package also keeps the data up-to-date by fetching daily modifications provided by the GeoNames service and uses them to synchronize your own database.

🔌 Installation

If you are going to use translations, you also need to install an additional package.

✅ Requirements

🔨 Usage

Publish the package resources using the command:

Seeding

Before seeding, make sure you run the database migrations.

Then, run the seeding process.

It will download geonames resources and insert the dataset into your database.

Note that the seeding process may take some time. On average, it takes about 40 minutes (without downloading time) to seed the full dataset with translations.

If you have issues with memory leaks during seeding, check out this section.

Schedule updates

Add the following code to the app/Console/Kernel.php file if you want to receive geonames daily updates.

Geonames daily updates are published at 3:00 in the UTC time zone, so to be sure that they are already available, it is recommended to run the command a bit later.

Note that time is specified for the UTC timezone.

Syncing

If you missed some daily updates or just decided to change seeder filters, you can sync your database records according to the current geonames dataset.

This command will create missing records, remove redundant ones, and updated modified ones according to the current dataset.

Note that the geoname_id and alternate_name_id fields is required to synchronize data.

Customization

If you want to customize migrations or data that should be imported, you can simply do this by overriding the default seeders.

To do that, publish the package seeders using command:

Publish the package config:

Then, specify published seeders in the config/geonames.php file:

Filtering

To reduce the database size, you can set up filters for seeding only those geo data that you really need in your application.

For example, you can set the minimum population for the city. All cities with smaller population will not be imported.

To do that, override the $minPopulation property in the CitySeeder class.

To have full control over this behaviour, override the filter method of the seeder.

Attributes mapping

To add custom fields to the table, you also need to tell the seeder how to fill those fields using the mapAttributes method.

The mapAttributes method should return all attributes of the database record, including timestamps, because model events will not be fired during seeding process since the package uses a bulk insert strategy. However, all model casts and mutators will be applied as usual.

For example, if you want to use UUIDs as primary keys, you can extend the original seeder as following:

Custom seeders

For a more significant change in the structure, you can add your own seeders or extend existing ones.

Each seeder must implement the Nevadskiy\Geonames\Seeders\Seeder interface.

All seeders that are specified in the geonames config file will be executed one by one in the specified order.

Translations

To use translations you need to install the nevadskiy/laravel-translatable package.

Read its documentation to learn more about how it works. You can also use it to handle translations of other models.

Otherwise, you still can use the package without translations, just simply remove the following:

Memory leaks

One of the most popular issues associated with seeding large amounts of data is a memory leak.

This package reads files using PHP generators and lazy collections to avoid loading the entire file into memory.

However, there are packages that log database queries and model events during long-running commands to memory, which leads to memory leaks.

There are instructions on how to avoid memory leaks when working with the following packages:

Laravel Ignition

Publish flare config using php artisan vendor:publish --tag=flare-config.

Set report_query_bindings to false in the flare.php config file as following:

Laravel Telescope

Update the telescope.php config file as following:

📑 Changelog

Please see CHANGELOG for more information what has changed recently.

☕ Contributing

Please see CONTRIBUTING for more information.

📜 License

The MIT License (MIT). Please see LICENSE for more information.


All versions of laravel-geonames with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
ext-zip Version *
laravel/framework Version ^8.0|^9.0|^10.0|^11.0
nevadskiy/downloader Version ^0.4.0
league/csv Version ^9.7
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 nevadskiy/laravel-geonames contains the following files

Loading the files please wait ....