Code Monkey home page Code Monkey logo

cakephp-geo's Introduction

CakePHP Geo Plugin

CI Coverage Status Latest Stable Version Minimum PHP Version License Coding Standards Total Downloads

A CakePHP plugin to

  • geocode locations/ips and save the information (lat/lng) along with the records
  • reverse geocode data
  • querying geocoded data by distance (using custom finder)
  • display (Google) maps (dynamic and static)

This branch is for CakePHP 5.0+. See version map for details.

Note that it uses the willdurand/geocoder library and therefore supports

  • 12+ address-based Geocoder providers
  • 10+ IP-based Geocoder providers

Most of them also support reverse geocoding. And of course you can write your own providers on top.

Also:

  • MySQL support
  • PostgreSQL support
  • SQLite support (for easy local testing)

And also:

  • GeocodedAddresses Table class for caching of API requests to prevent rate limits and speed up lookups.

Demo

See Sandbox examples for live demos of the GoogleMaps helper and the Geocoder behavior.

Installation & Docs

cakephp-geo's People

Contributors

admad avatar ajfranzoia avatar alecho avatar angelxmoreno avatar bar avatar cewi avatar challgren avatar chopstik avatar chrisspony avatar codaxis avatar dereuromark avatar dismounted avatar dsgraham avatar ervinszabo avatar gringlas avatar justinatack avatar justindenick avatar lamasgergo avatar ldsign avatar lorenzo avatar steefaan avatar zeroasterisk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cakephp-geo's Issues

How do I invalidate if address cannot be geocoded?

I tried configuring the behavior with 'on' => 'beforeMarshal' and then setup a validation rule like:

$validator
            ->isArray('geocoder_result')
            ->requirePresence('geocoder_result')
            ->notEmpty('geocoder_result');

When I debug the entity after running patchEntity(), the value of geocoder_result is 'geocoder_result' => '""', and this is for a correct address.

If I use a bad address, then geocoder_result property doesn't even exist.

Google Map Helper doesn't go directly to marker point

Hi, first of all thanks for this awesome plugin! It has helped me a lot in a project.
I think it's more a doubt than a issue. When I set a marker and render the map, my map doesn't render at the marker location, for example I set a marker to Brazil, and when the map renders it is positioned at Europe. The marker is in it's correct place, but we need to drag the map to Brazil to see it. Is there any config to auto positioning the map?

entities doesn't save when adress fields are empty

Hi,
if i set adress fields optionals, and i want to add a new Entity without adress, the geodecoder behavior invalidate the entities and the save event is cancelled.

for fixing this, change this line in GeocoderBehavior.php :

        if ($search === '') {
            return NULL;
        }

to

        if ($search === '' && !$this->_config['allowEmpty']) {
            return NULL;
        }

How to catch invalid address in behavior

When saving an address with invalid data there is an sql error because lat/lng cannot be processed. How to catch this problem?

Thanks in advance!

Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')) * COS(((RADIANS((Matches.lng)) - RADIANS())))) + (SIN((((PI() / 2) - RADIANS(' at line 1

Undefined index: accuracy

This is a little strange. I'm querying for an address and within the _process method, I'm retrieving a result which is, for some reason, showing up as an invalid result (valid_results = false) and in doing so, my seemingly valid/invalid result isn't providing the accuracy index on line 417 of the Geocode.php class.

if ($this->_isNotAccurateEnough($this->result['accuracy'])) {

So that I can be extra annoying but potentially helpful, here is my full response:

$result = [
    'results' => [
        (int) 0 => [
            'formatted_address' => '304 Elmwood Ave, Buffalo, NY 14222, USA',
            'country' => 'United States',
            'country_code' => 'US',
            'country_province' => 'New York',
            'country_province_code' => 'NY',
            'postal_code' => '14222',
            'locality' => 'Buffalo',
            'sublocality' => '',
            'route' => 'Elmwood Avenue 304',
            'types' => [
                [maximum depth reached]
            ],
            'lat' => (float) 42.9052435,
            'lng' => (float) -78.8775244,
            'location_type' => 'ROOFTOP',
            'viewport' => [
                [maximum depth reached]
            ],
            'bounds' => [
                [maximum depth reached]
            ],
            'address_components' => [
                [maximum depth reached]
            ],
            'valid_type' => false,
            'accuracy' => (int) 7,
            'accuracy_name' => 'route'
        ]
    ],
    'status' => 'OK'
]

GoogleMap helper $options not correct

For example the $option for zoom is not exposed correctly in javascript. The following configuration in php is wrong in javascript variable myOptions. Es I can see the variable myOptions does never change its parameters.

            $options = [
                'zoom' => 15,
                'type' => 'R',
                'geolocate' => true,
                'div' => ['id' => 'someothers'],
                'map' => [
                    'navOptions' => ['style' => 'SMALL'],
                    'typeOptions' => ['style' => 'HORIZONTAL_BAR', 'pos' => 'RIGHT_CENTER']]
            ];

            $map = $this->GoogleMap->map($options);

var myOptions = {zoom: 5, streetViewControl: false, navigationControl: true, mapTypeControl: true, scaleControl: true, scrollwheel: false, keyboardShortcuts: true, center: initialLocation, navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR, position: google.maps.ControlPosition.RIGHT_CENTER}, mapTypeId: google.maps.MapTypeId.ROADMAP};

Allow passing `Coordinates` instance to `distance` finder.

Often when using find('distance') you have a Coordinates instance at hand from an earlier geocoding operation.

So using

find('distance', ['coordinates ' => $coordinates])

would require less typing than

->find('distance', [
    'lat' => $coordinates->getLatitude(),
    'lng' => $coordinates->getLongitude(),
])

Not 3.6 compatible

Cake\Log\Log::config() is deprecated. Use setConfig()/getConfig() instead. - /home/sdustinh/github/cakephp/app/vendor/dereuromark/cakephp-geo/config/bootstrap.php, line: 8

Use of cake3-branch results in deprecation errors

First let me thank you for keeping this plugin available for both CakePHP 3.x and 4.x.

Unfortunately, it seems impossible to use the CakePHP Geo Plugin within CakePHP 3.x-applications without deprecation errors being thrown out.

CakePHP Geo for CakePHP 3 (aka CakePHP Geo 1.x) requires willdurand/geocoder ^3.3.
willdurand/geocoder ^3.3 requires egeloen/http-adapter ~0.8.

The Ivory Http Adapter was abandoned and is no longer maintained. Unfortunately this dependency is causing deprecated errors since some things have been moved around within CakePHP. Mainly their CakeHttpAdapter not using the new function naming and namespaces of the Request and Response objects within CakePHP.

egeloen/http-adapter suggests php-http/httplug as an alternative.

I've tried configuring CakePHP Geo to use httplug and also the http-adapter within CakePHP. Unfortunately, version 3.3 of willdurand/geocoder explicitly expects egeloen/http-adapter-objects as parameters and/or return values. I was not able to get the Google Maps provider working with a different http adapter than the default one.

The issue of depending on Ivory Http Adapter has been fixed in Geocoder 4.x.
Sadly this version of Geocoder is not supported by the Cake3/1.x branch of CakePHP Geo.

Of course we could turn of deprecation warnings in PHP, but this is not very eligible. Their cause would remain and will cause real problems if these deprecation warnings by any means turn into real errors.

Of course upgrading to Cake 4.x solves these issues. But at the moment Cake 3.x is still supported, as is CakePHP Geo for CakePHP 3.x. Having to refactor entire applications to CakePHP 4.x in very short time just because we're not able to replace some third party adapter would be a bit silly.

Is there any chance there will be a version of CakePHP Geo for CakePHP 3.x that works together with Geocoder 4.x?

If anyone knows an alternative workaround for just ignoring the deprecation messages that would be highly appreciated as well.

Class 'Geocoder\Provider\GoogleMaps\GoogleMaps' not found

Hi

We are trying to upgrade to CakePHP 4 and ran into this issue:

Error: Class 'Geocoder\Provider\GoogleMaps\GoogleMaps' not found in .../vendor/dereuromark/cakephp-geo/src/Geocoder/Geocoder.php:306

Also it looks like StatefulGeocoder is also not defined.

What are we doing wrong?

Thanks and regards,
Patrick

Custom-find-method 'distance' doesn't fetch other properties

What I did:
I have a table in my database with institutions. They have properly filled lat and lng-fields.
The GeocoderBehavior is attached to the InstitutionsTable.php in the initialize-method:

$this->addBehavior('Geo.Geocoder', [
            'address' => [
                'strasse', 'plz', 'ort'
            ],
            'override' => true,
        ]);

I created a method 'nearestThree' in InstitutionsTable.php:

public function nearestThree($address = '') {
        $this->Geocode = new Geocode();
        if ($this->Geocode->geocode($address)) {
            $result = $this->Geocode->getResult();
            if (isset($result[0])) {
                $result = array_shift($result);
            }
            $query = $this->find('all')->limit(3);
            $query->find('distance', $result);
            return $query->all();
        }
        return false;
    }

The result consists of three entities but they have only one property: 'distance'. Other find-methods work like expected.

Missing classes

Geocoder is trying to use unavailable classes

$this->adapter = new $adapterClass(new HttpCakeClient(), new ResponseFactory());

Both Http\Adapter\Cake\Client and Http\Message\ResponseFactory are not available.

It seems installation doc is outdated. What are the correct steps to install and use the plugin?

Deprecation messages with 1.3.4, in Cake 3.7.4.

With this plugin loaded I get a large number of deprecation messages:

Deprecated (16384): Geo\Geocoder\Geocoder::config() is deprecated. Use setConfig()/getConfig() instead. - /home/vagrant/code/vendor/dereuromark/cakephp-geo/src/Geocoder/Geocoder.php, line: 281
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Geo\Geocoder\Geocoder::config() is deprecated. Use setConfig()/getConfig() instead. - /home/vagrant/code/vendor/dereuromark/cakephp-geo/src/Geocoder/Geocoder.php, line: 287
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Use Cake\Http\Client instead of Cake\Network\Http\Client. - /home/vagrant/code/vendor/composer/ClassLoader.php, line: 444
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Geo\Geocoder\Geocoder::config() is deprecated. Use setConfig()/getConfig() instead. - /home/vagrant/code/vendor/dereuromark/cakephp-geo/src/Geocoder/Geocoder.php, line: 289
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Geo\Geocoder\Geocoder::config() is deprecated. Use setConfig()/getConfig() instead. - /home/vagrant/code/vendor/dereuromark/cakephp-geo/src/Geocoder/Geocoder.php, line: 289
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Geo\Geocoder\Geocoder::config() is deprecated. Use setConfig()/getConfig() instead. - /home/vagrant/code/vendor/dereuromark/cakephp-geo/src/Geocoder/Geocoder.php, line: 289
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Geo\Geocoder\Geocoder::config() is deprecated. Use setConfig()/getConfig() instead. - /home/vagrant/code/vendor/dereuromark/cakephp-geo/src/Geocoder/Geocoder.php, line: 289
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Use Cake\Http\Client\Request instead of Cake\Network\Http\Request. - /home/vagrant/code/vendor/composer/ClassLoader.php, line: 444
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Request::header() is deprecated. Use withHeader() and getHeaderLine() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 57
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Request::header() is deprecated. Use withHeader() and getHeaderLine() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 57
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Request::header() is deprecated. Use withHeader() and getHeaderLine() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 57
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Request::method() is deprecated. Use getMethod() and withMethod() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 60
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Request::url() is deprecated. Use getUri() and withUri() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 62
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Request::version() is deprecated. Use getProtocolVersion() and withProtocolVersion() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 63
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Response::statusCode() is deprecated. Use Response::getStatusCode() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 75
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Response::version() is deprecated. Use Response::getProtocolVersion() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 76
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Message::headers() is deprecated. Use getHeaders() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 77
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Deprecated (16384): Response::body() is deprecated. Use getStringBody()/getJson()/getXml() instead. - /home/vagrant/code/vendor/egeloen/http-adapter/src/CakeHttpAdapter.php, line: 78
 You can disable deprecation warnings by setting `Error.errorLevel` to `E_ALL & ~E_USER_DEPRECATED` in your config/app.php. [CORE/src/Core/functions.php, line 311]
Warning (512): Unable to emit headers. Headers sent in file=/home/vagrant/code/vendor/cakephp/cakephp/src/Error/Debugger.php line=853 [CORE/src/Http/ResponseEmitter.php, line 48]
Warning (2): Cannot modify header information - headers already sent by (output started at /home/vagrant/code/vendor/cakephp/cakephp/src/Error/Debugger.php:853) [CORE/src/Http/ResponseEmitter.php, line 148]
Warning (2): Cannot modify header information - headers already sent by (output started at /home/vagrant/code/vendor/cakephp/cakephp/src/Error/Debugger.php:853) [CORE/src/Http/ResponseEmitter.php, line 177]

They are not all related to the plugin, but if I disable it, then I all the deprecation messages disappear. If I want to fix, should I just fork and comb through the code to make the necessary updates? Or is this already underway?

Im new to using cakephp 3 and googlemaps

Good evening Mark,

Im trying to use your googlemaps helper to insert a map and then place markers onto it using lat and lng from an outsourced xml feed and not from a database.

Ive followed the examples in your documents but cant get the helper to load without using the $config variable.

I know its probably my ignorance within lack of knowledge however from the list of config options you have set out I cant see any reason to change from the default.

when I use $this->loadHelper('Geo.GoogleMap', $config); all I get from the website is the following error,

Argument 2 passed to Cake\View\View::loadHelper() must be of the type array, null given, called in /home/airnexvi/public_html/src/Template/Airoperations/fleetview.ctp on line 2

Timezone by geo

Include maybe

	/**
	 * Gets the timezone that is closest to the given coordinates
	 *
	 * @param float $lat
	 * @param float $lng
	 * @return \DateTimeZone Timezone object
	 */
	public static function timezoneByCoordinates($lat, $lng) {
		$current = ['timezone' => null, 'distance' => 0];
		$identifiers = DateTimeZone::listIdentifiers();
		foreach ($identifiers as $identifier) {
			$timezone = new DateTimeZone($identifier);
			$location = $timezone->getLocation();
			$point = ['lat' => $location['latitude'], 'lng' => $location['longitude']];
			$distance = (int)Calculator::calculateDistance(compact('lat', 'lng'), $point);
			if (!$current['distance'] || $distance < $current['distance']) {
				$current = ['timezone' => $identifier, 'distance' => $distance];
			}
		}
		return $current['timezone'];
	}

Using this plugin for optimized route between multiple addresses

Hi there,

I'd like to send google a start address, list of addresses, and an end point and then get a return array of the optimized route.. is this possible with this plugin?

Can't wait for the documentation to be complete :) From what I can see so far, this is a great plugin.

Thanks.

`overwrite` option of GeocodeBehavior is unused.

In CakePHP 2.x compatible version of this plugin if overwrite was false and entity (model data) already had latitude and longitude fields filled then geocoding was skipped.

This feature allowed users to provide their own values or leave the fields empty in which case the lat-lng was geocoded using the address fields. I need back this behavior in current version of this plugin ๐Ÿ™‚.

Generated map not accessible outside of jquery ready?

Sometime you need to use map after the helper generated it. Now all maps generated into a local variable. jQuery(document).ready(function() { var map0 = .... });

For examle if you would like to modify on the map object you have no acces for it, haven't you?

Maybe it would great to fire a jquery event after the map was generated, so you can catch the event and if the event contains the generated map object you can do anyting wit that map after.

or simple make the map object globally :) without "var"

Am I wrong? We would like to use clusterer or router box.

InfoWindows not correct displayed

InfoWindows set with GoogleMapsV3Helper->addMarker($option['content]) are now showing only an empty box. When setting $_defaultOptions['map']['api'] to anything below '3.19', i.e. '3.18' in the Helper, or passing an api-Version below 3.19 in the constructor, everything is displayed as expected. Tested on Safari, Firefox 35 and Chrome 40 on Mac. Same with the GoogleMapsV3Helper in the Tools-Plugin for Cake 2.
Maybe Google changed the API? (My Application worked well for a more than a year and then stopped showing proper InfoWindows, I didn't change any Code)

staticMap method does not use globally configured Google API key

I just wanted to display a static map and found that the map image never showed up. Looking at the image URL, I saw that no API key was being added (and Google was telling me that the API key is required; when I added the key manually, the static image URL worked). I debugged around and proved to myself that my key was actually getting loaded properly from the GoogleMap index of the configuration array. Eventually I determined that, although apiUrl() adds the key as expected, only map() calls that and not staticMap(). Since apiUrl didn't seem directly usable by staticMapUrl, I patched staticMapUrl to also add the API key. This at least gets the staticMap calls working as expected.
Here is a diff for the modified code. Not sure this is the optimal solution, since I only added the key configuration processing code from apiUrl into the staticMapUrl function.


cakephp-geo-fix-staticmap-api-key.patch.txt

Error in Documentation of Geocoder Library?

Hi,

I set up Geocoder library as described here:
https://github.com/dereuromark/cakephp-geo/blob/master/docs/Geocoder/Geocoder.md

My code in app.php:

    'Geocoder' => [
        'provider' => '\Geocoder\Provider\OpenStreetMap',
    ],

My code in a controller:

...
$this->Geocoder = new \Geo\Geocoder\Geocoder();
$this->Geocoder->setOptions([
                'allowInconclusive' => true,
                'minAccuracy' => Geocoder::TYPE_POSTAL]);
...

This throws an Error:

Call to undefined method Geo\Geocoder\Geocoder::setOptions()

Looking at the code in
https://github.com/dereuromark/cakephp-geo/blob/master/src/Geocoder/Geocoder.php, there is no setOptions() method.

Passing the options instead to the constructor works as expected. Is there an error in the docs or are there mistakes in my setup?

Strange maps behaviour

I use your plugin and this is how the maps behave
may-15-2018 15-33-42

and the following is my code

<div class="transactions view large-10 medium-8 columns content">
<?php
	$this->layout = 'map';
	$options = [
		'zoom' => 10,
		'type' => 'R',
		'geolocate' => true,
		'div' => ['id' => 'map'],
		'map' => ['navOptions' => ['style' => 'SMALL'], 'typeOptions' => ['style' => 'HORIZONTAL_BAR', 'pos' => 'RIGHT_CENTER']]
	];
	$map = $this->GoogleMap->map($options);

	// You can echo it now anywhere, it does not matter if you add markers afterwards
	echo $map;

	// Let's add some markers
	$this->GoogleMap->addMarker(['lat' => $transaction->lat_in, 'lng' => $transaction->lng_in, 'title' => 'Log in Location']);

	// Store the final JS in a HtmlHelper script block
	$this->GoogleMap->finalize();
?>
	<div id="map">
	</div>
</div>

what could be the problem??

Keeping lat lng in sync with Migrations?

I am using this plugin for a project where we baked a migration using latitude longitude (https://book.cakephp.org/migrations/2/en/index.html#columns-definition), turns out, I had to define in config
https://github.com/dereuromark/cakephp-geo/blob/master/src/Model/Behavior/GeocoderBehavior.php#L47:L48
It is not a major inconvenience but I propose to have a consistency with baked migrations...... if it doesn't result in breaking changes (which it will, I guess ! ๐Ÿ’ฏ )

Pick lat&lng on the map

Is it possible to pick lat&lng on the map?
Just choose the location on the map and get coordinates with this package?

Link to missing page in docs.

docs/README.md has link Search plugin integration to URL https://github.com/dereuromark/cakephp-geo/blob/master/docs/Geocoder/Search.md which doesn't exist.

Define API key during runtime

Hi

We would like to be able to define the API key during runtime, so each user can add his own Google API key (since we are a platform, our Google API invoice is getting bigger and bigger). Is there any way to do this?

Thank you very much.
Patrick

wrong Exception?

Hi I'm new to cake3,
in line 519 of GoogleMapV3Helper.php there is a 'CakeException' thrown. That did not work in my setup. I changed it to '\Exception' and it worked. But maybe you'd better import the namespace?

Class 'Http\Adapter\Cake\Client' not found

Error when using with CakePHP 4.1.7

I'm using the Geocoder behavior in a model and I ran into this error, it looks like it can't find the class in Geocoder.php. Is there a dependency here not being specified?

The settings I have in the model are

    $this->addBehavior(
        'Geo.Geocoder',
        [
            'apiKey' => Configure::read('Settings.App.google_maps_api_key'),
            'address' => ['address', 'city', 'zip'],
            'overwrite' => true
        ]
    );

In case it wasn't clear the error I am getting is:
Class 'Http\Adapter\Cake\Client' not found

I've discovered the dependency: https://github.com/php-http/cakephp-adapter

After that however, after requiring it I get a new error:
Fatal error: Interface 'Http\Message\ResponseFactory' not found in /vagrant/iec/httpdocs/vendor/dereuromark/cakephp-geo/src/Geocoder/ResponseFactory.php on line 8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.