Problem/Motivation
Many users like myself do not have access to a environment where composer can be used to install modules and have to look to ludwig as a answer.
Proposed resolution
Add ludwig.json file to installation to enable ludwig to handle needed package installations
What i have put together so far is the following.
{
"require": {
"davedevelopment/stiphle": {
"version": "v0.9.2",
"url": "https://github.com/davedevelopment/stiphle/archive/0.9.2.zip"
},
"willdurand/geocoder": {
"version": "v4.3.0",
"url": "https://github.com/geocoder-php/php-common/archive/4.3.0.zip"
},
"clue/stream-filter": {
"version": "v1.5.0",
"url": "https://github.com/clue/stream-filter/archive/v1.5.0.zip"
},
"php-http/message-factory": {
"version": "v1.0.2",
"url": "https://github.com/php-http/message-factory/archive/v1.0.2.zip"
},
"php-http/message": {
"version": "v1.10.0",
"url": "https://github.com/php-http/message/archive/1.10.0.zip"
},
"psr/http-client": {
"version": "v1.0.1",
"url": "https://github.com/php-fig/http-client/archive/1.0.1.zip"
},
"php-http/promise": {
"version": "v1.1.0",
"url": "https://github.com/php-http/promise/archive/1.1.0.zip"
},
"php-http/httplug": {
"version": "v2.2.0",
"url": "https://github.com/php-http/httplug/archive/2.2.0.zip"
},
"php-http/guzzle6-adapter": {
"version": "v2.0.1",
"url": "https://github.com/php-http/guzzle6-adapter/archive/v2.0.1.zip"
},
"php-http/discovery": {
"version": "v1.13.0",
"url": "https://github.com/php-http/discovery/archive/1.13.0.zip"
},
"geocoder-php/common-http": {
"version": "v4.3.0",
"url": "https://github.com/geocoder-php/php-common-http/archive/4.3.0.zip"
},
"geocoder-php/google-maps-provider": {
"version": "v4.5.0",
"url": "https://github.com/geocoder-php/google-maps-provider/archive/4.5.0.zip"
}
}
}
Comments
Comment #2
itamair commentedProvide a working patch on this, that can be tested and reviewed by other users.
I am pretty users how many Drupal builders and developers are (still) really not using composer ...
Comment #3
devad commentedIn Ludwig ver. 8.x-1.6 a new Ludwig service is added which can be used.
The 'files' and 'classmap' libraries integration with Ludwig is more simple now.
This patch should work nicely.
Maintaining of Ludwig integration
If the new versions of libraries will be required by Geocode in some future release, the ludwig.json file should be updated to mirror new Geocode's composer.json file dependency tree.
Both Address module and Geofield module have their Ludwig integrations or working patches, so if used, they should be able to cooperate together with respective Geocode sub-modules without Composer (with Ludwig).
Comment #4
eit2103 commentedGreat addition, thank you!
Comment #5
devad commentedYou are welcome @eit2103
If you are going to try this patch and other two patches (Address module, Geofield module) linked in the same comment, please kindly reply back with your reviews of these patches in respective issue queues - and report issues if any. So that we can push all these patches to RTBC and possible commit.
Thank you.
Comment #6
itamair commentedthis issue looks triggered and related by this Ludwing integration task: https://www.drupal.org/project/geocoder/issues/3195600
Comment #7
itamair commentedPlease, let's bear in mind that:
Comment #8
devad commentedThanks for cross-posting @itamar.
@eit2103: Can you copy-paste here the whole content of ludwig.json file from your Geocode module root folder for debuging purposes.
Also, did you follow the how-to-use Ludwig guide steps described here: Ludwig installation and usage?
Comment #9
devad commentedHence @eit2103 is not replying... lets move status here back to "Needs review" for others to test patch #03 and post back results.
The Geofield module just added its Ludwig integration today. Let's hope we can move this to RTBC soon as well... for users to be able to use both modules together without Composer (with Ludwig).
Comment #10
bond708 commentedHi,
I was hoping this patch would fix my issue.
I also use Ludwig but can not add providers. Error: Class 'Geocoder\Provider\AbstractProvider' not found :
After adding the patch my site was down :)
Comment #11
devad commentedHi @bond708
This patch is for Geocoder module.
It seems from your report that you have applied this patch manually to your Geofield module. That's wrong.
The Geofield module ver. 8.x-1.20 has Ludwig integration implemented already and it does not need any patches to work with Ludwig nicely.
Just apply this patch #3 to your GEOCODER module and reply back if your issue is resolved.
Comment #12
bond708 commentedHi @devad
I applied the patch to geocoder, not geofield. Meanwhile I managed to install it correctly using composer.
Comment #13
devad commentedRe: #12:
Yes, Composer is the best solution always.
Your "my site was down" error report is complaining about Geofield module:
Exception: The clue/stream-filter library "version" argument in /home/liminalmapping/public_html/modules/geofield/ludwig.json file is empty. in Drupal\ludwig\RequireOnce->requireOnce() (line 43 of /home/liminalmapping/public_html/modules/ludwig/src/RequireOnce.php)
#0 /home/liminalmapping/public_html/modules/geofield/geofield.module(15):
I have marked the important parts bold... as you can see your error is all about Geofield module... not Geocoder.
So, maybe you applied the patch to Geofield module accidentally. These two modules have a very similar name after all.
I do not see any other way how your error can happen. The original Geofield module has an empty line in line no. 15 of geofield.module file, so it can not produce above error. The logic conclusion is that the geofield.module file is accidentally patched.
If you can try to properly apply the patch to the Geocoder module and check if it will reproduce the same error again - and reply back the result - that would be helpful to move this issue forward.
Comment #14
Duvan.Slabbert commentedPatch #3 is working great for me on both the latest versions of drupal 8.9.14 and 9.1.7. For future reference to those using the patch, you need to read the Geocoder installation instruction for D8/D9 carefully, you will still need to install a Geocode provider of your choice over here to be able to geocode.
I did include google-maps-provider in the original post
but that did not make it to the patch as not every user will want to use the google-maps-provider.
Comment #15
devad commented(Updated 01/2022)
Re: #21
This addition to ludwig.json file should work for geocoder-php/google-maps-provider.
So, at the end, your ludwig.json file should have the following content:
Note: If you are applying the patch code manually, don't forget to patch the .module file as well.
Comment #16
devad commentedMarking RTBC as per #14. Thank you for review @Duvan.Slabbert. More reviews are welcome.
Comment #17
transmitter commentedJust tried it with Drupal core 9.1.8 and Geocoder 8.x-3.20.
Seems to be working well with Ludwig here, thanks for the Patch.
Comment #18
joaomachado commented+1 for ludwig integration...
Comment #19
Rodeo.be commentedJust tried it with 8.x-3.20+2-dev and Drupal 9.1.8. The proposed patch works!
Comment #20
devad commentedPing to: @itamair
This looks like tested enough. Can we have this committed and new release published soon maybe?
Comment #21
leha373 commentedAnd how to add a Yandex provider?Thanks
Comment #22
devad commentedRe: #21
This addition to ludwig.json file should work for yandex.
So, at the end, your ludwig.json file should have the following content:
Note: If you are applying the patch code manually, don't forget to patch the .module file as well.
Comment #23
devad commentedIn this patch:
- Updating the
ludwig.jsonfile with the latest library releases.- Adding the "d8" Drupal Core compatibility argument to the
psr/http-clientlibrary.Comment #24
devad commentedIn this patch:
- Removing the Ludwig-deprecated "disable_warnings": "TRUE"
ludwig.jsonargument.Comment #27
rajeshreeputraComment #28
itamair commentedHi here ... is this still valid/relevant?
Should we merge/commit #24 this into 8.x-3.x-dev?
I am not going to (cannot) test the Ludwig integration ... so I would need a RTBC by someone that did it.
Comment #29
devad commentedMultiple library versions are updated to the latest releases.
If we are going to commit this soon it's better to have the latest versions inside the ludwig.json file.
Comment #30
itamair commentedOk nice. So is the #29 patch RTBC and ready to be committed into code base?
Comment #31
devad commentedIt's ready as far as I am concerned. However, I am the author of the patch and by Drupal rules I should not be the one to declare it as RTBC also.
I suppose we can declare it as RTBC due to community comments #14, #17 and #19 which were reviews of very similar patches before. But it's up to you to decide if you want to commit it now or wait for more community reviews. :)
Comment #34
itamair commentedOk, adde this on both 8.x-3.x-dev and 8.x-4.x-dev branches
Comment #35
devad commentedThanks @itamair.
I have added the Geocoder project to the Ludwig module ecosystem list.