Download the PHP package craue/geo-bundle without Composer

On this page you can find all versions of the php package craue/geo-bundle. 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 geo-bundle

Information

Build Status

CraueGeoBundle provides Doctrine functions for your Symfony project which allow you to calculate geographical distances within database queries. This bundle is independent of any web service, so once you got it running, it will keep running. There are two Doctrine functions, which return a distance in km:

Installation

Get the bundle

Let Composer download and install the bundle by running

in a shell.

Enable the bundle

If you don't use Symfony Flex, register the bundle manually:

Or, for Symfony 3.4:

Prepare the table with geographical data needed for calculations

The GEO_DISTANCE_BY_POSTAL_CODE function, if you'd like to use it, relies on some data which has to be added to your database first.

Create the table

The GeoPostalCode entity provided contains the structure for the geographical data. You import it by calling either

or

or however you like.

Import the geographical data

This is probably the most annoying step: Storing all postal codes with their geographical positions for the countries you need. Fortunately, it's not that hard to get this information and import it into your database.

Go to http://download.geonames.org/export/zip/ and download the archives for the countries you need. Let's just take DE.zip. Unzip the included DE.txt file, e.g. to /tmp/DE.txt.

Create a fixture class (in a separate folder to be able to load only this one) which extends the provided base class:

Now, backup your database! Don't blame anyone else for data loss if something goes wrong. Then import the fixture and remember to use the --append parameter.

Choose the following steps depending on the version of DoctrineFixturesBundle you're using.

DoctrineFixturesBundle < 3.0 Load the fixture(s) in the given folder.
DoctrineFixturesBundle >= 3.1 1. a) You first need to register the fixture as a service with a group of your choice. 1. b) It's also possible to register all classes in a specific folder as services. 2. Then, load the fixture(s) of that group.

That's it.

You can also use other data sources you have access to, and write a custom fixture to import it.

If you have out of memory issues when importing a large number of entries try adding the --no-debug switch to avoid logging every single Doctrine query.

Usage

Let's say you have an entity Poi containing countries and postal codes. Now you wish to find all entities within a specific geographical distance with a radius of $radiusInKm from a given postal code $postalCode in country $country, and order them by distance.

Advanced stuff

Using the Doctrine functions for a different database platform

By default, the Doctrine functions are automatically registered for usage with MySQL. But you can tell the bundle that you want to use them with a different database platform by setting a flavor:

Currently, the following flavors are supported:

As PostgreSQL doesn't support aliases in the HAVING clause and further requires poi to appear in the GROUP BY clause, you need to adapt the query (from the usage example above):

Avoid creating the postal code table

If you want to avoid registering the GeoPostalCode entity (and as a result, avoid creating the craue_geo_postalcode table) at all, add

to your configuration.

Use custom names for the Doctrine functions

If you don't like the default names or need to avoid conflicts with other functions, you can set custom names:


All versions of geo-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8
doctrine/doctrine-bundle Version ^1.6.12|^2
doctrine/orm Version ^2.5.2
symfony/config Version ~4.4|~5.3|^6
symfony/dependency-injection Version ~4.4|~5.3|^6
symfony/framework-bundle Version ~4.4|~5.3|^6
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 craue/geo-bundle contains the following files

Loading the files please wait ....