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"
        }
    }
}

Issue fork geocoder-3195238

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Duvan.Slabbert created an issue. See original summary.

itamair’s picture

Status: Active » Needs work

Provide 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 ...

devad’s picture

Version: 8.x-3.14 » 8.x-3.x-dev
Status: Needs work » Needs review
StatusFileSize
new2.29 KB

In 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).

eit2103’s picture

Great addition, thank you!

devad’s picture

You 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.

itamair’s picture

this issue looks triggered and related by this Ludwing integration task: https://www.drupal.org/project/geocoder/issues/3195600

itamair’s picture

Status: Needs review » Needs work

Please, let's bear in mind that:

  • All issues related to this Task/Feature request should be reported here!
  • No fully tested and reviewed solid/fully drupal/php cs compliant patches/solutions (and potentially regressive) will be merged in the module ...
devad’s picture

Thanks 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?

devad’s picture

Status: Needs work » Needs review

Hence @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).

bond708’s picture

Hi,
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 :

Error: Class 'Geocoder\Provider\AbstractProvider' not found in include() (line 20 of /home/liminalmapping/public_html/modules/geocoder/modules/geocoder_field/src/Geocoder/Provider/File.php)
#0 /home/liminalmapping/public_html/vendor/composer/ClassLoader.php(444): include()
#1 /home/liminalmapping/public_html/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/home/liminalma...')
#2 [internal function]: Composer\Autoload\ClassLoader->loadClass('Drupal\\geocoder...')
#3 [internal function]: spl_autoload_call('Drupal\\geocoder...')
#4 /home/liminalmapping/public_html/modules/geocoder/geocoder.module(50): class_exists('\\Drupal\\geocode...')
#5 [internal function]: {closure}(Array)
#6 /home/liminalmapping/public_html/modules/geocoder/geocoder.module(51): array_filter(Array, Object(Closure))

After adding the patch my site was down :)

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): Drupal\ludwig\RequireOnce->requireOnce('clue/stream-fil...', 'src/functions_i...', '/home/liminalma...')
#1 /home/liminalmapping/public_html/core/lib/Drupal/Core/Extension/Extension.php(147): include_once('/home/liminalma...')
#2 /home/liminalmapping/public_html/core/lib/Drupal/Core/Extension/ModuleHandler.php(128): Drupal\Core\Extension\Extension->load()
devad’s picture

Hi @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.

bond708’s picture

Hi @devad

I applied the patch to geocoder, not geofield. Meanwhile I managed to install it correctly using composer.

devad’s picture

Re: #12:

Yes, Composer is the best solution always.

I applied the patch to geocoder, not geofield.

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.

Duvan.Slabbert’s picture

Patch #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

"geocoder-php/google-maps-provider": {
    "version": "v4.5.0",
    "url": "https://github.com/geocoder-php/google-maps-provider/archive/4.5.0.zip"
}

but that did not make it to the patch as not every user will want to use the google-maps-provider.

devad’s picture

(Updated 01/2022)

Re: #21

This addition to ludwig.json file should work for geocoder-php/google-maps-provider.

        },
        "php-http/discovery": {
            "version": "v1.14.1",
            "url": "https://github.com/php-http/discovery/archive/1.14.1.zip"
        },
        "geocoder-php/common-http": {
            "version": "v4.4.0",
            "url": "https://github.com/geocoder-php/php-common-http/archive/4.4.0.zip"
        },
        "geocoder-php/google-maps-provider": {
            "version": "v4.6.0",
            "url": "https://github.com/geocoder-php/google-maps-provider/archive/4.6.0.zip"
        }

So, at the end, your ludwig.json file should have the following content:

{
    "require": {
        "davedevelopment/stiphle": {
            "version": "0.9.2",
            "url": "https://github.com/davedevelopment/stiphle/archive/0.9.2.zip"
        },
        "willdurand/geocoder": {
            "version": "4.5.0",
            "url": "https://github.com/geocoder-php/php-common/archive/4.5.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": "1.12.0",
            "url": "https://github.com/php-http/message/archive/1.12.0.zip"
        },
        "psr/http-client d8": {
            "version": "1.0.1",
            "url": "https://github.com/php-fig/http-client/archive/1.0.1.zip"
        },
        "php-http/promise": {
            "version": "1.1.0",
            "url": "https://github.com/php-http/promise/archive/1.1.0.zip"
        },
        "php-http/httplug": {
            "version": "2.2.0",
            "url": "https://github.com/php-http/httplug/archive/2.2.0.zip"
        },
        "php-http/guzzle6-adapter": {
            "version": "v2.0.2",
            "url": "https://github.com/php-http/guzzle6-adapter/archive/v2.0.2.zip"
        },
        "php-http/discovery": {
            "version": "v1.14.1",
            "url": "https://github.com/php-http/discovery/archive/1.14.1.zip"
        },
        "geocoder-php/common-http": {
            "version": "v4.4.0",
            "url": "https://github.com/geocoder-php/php-common-http/archive/4.4.0.zip"
        },
        "geocoder-php/google-maps-provider": {
            "version": "v4.6.0",
            "url": "https://github.com/geocoder-php/google-maps-provider/archive/4.6.0.zip"
        }
    }
}

Note: If you are applying the patch code manually, don't forget to patch the .module file as well.

devad’s picture

Status: Needs review » Reviewed & tested by the community

Marking RTBC as per #14. Thank you for review @Duvan.Slabbert. More reviews are welcome.

transmitter’s picture

Just 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.

joaomachado’s picture

+1 for ludwig integration...

Rodeo.be’s picture

Just tried it with 8.x-3.20+2-dev and Drupal 9.1.8. The proposed patch works!

devad’s picture

Ping to: @itamair

This looks like tested enough. Can we have this committed and new release published soon maybe?

leha373’s picture

And how to add a Yandex provider?Thanks

devad’s picture

Re: #21

This addition to ludwig.json file should work for yandex.

        },
        "php-http/discovery": {
            "version": "v1.14.1",
            "url": "https://github.com/php-http/discovery/archive/1.14.1.zip"
        },
        "geocoder-php/common-http": {
            "version": "v4.4.0",
            "url": "https://github.com/geocoder-php/php-common-http/archive/4.4.0.zip"
        },
        "geocoder-php/yandex-provider": {
            "version": "v4.4.0",
            "url": "https://github.com/geocoder-php/yandex-provider/archive/4.4.0.zip"
        }

So, at the end, your ludwig.json file should have the following content:

{
    "require": {
        "davedevelopment/stiphle": {
            "version": "0.9.2",
            "url": "https://github.com/davedevelopment/stiphle/archive/0.9.2.zip"
        },
        "willdurand/geocoder": {
            "version": "4.5.0",
            "url": "https://github.com/geocoder-php/php-common/archive/4.5.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": "1.12.0",
            "url": "https://github.com/php-http/message/archive/1.12.0.zip"
        },
        "psr/http-client d8": {
            "version": "1.0.1",
            "url": "https://github.com/php-fig/http-client/archive/1.0.1.zip"
        },
        "php-http/promise": {
            "version": "1.1.0",
            "url": "https://github.com/php-http/promise/archive/1.1.0.zip"
        },
        "php-http/httplug": {
            "version": "2.2.0",
            "url": "https://github.com/php-http/httplug/archive/2.2.0.zip"
        },
        "php-http/guzzle6-adapter": {
            "version": "v2.0.2",
            "url": "https://github.com/php-http/guzzle6-adapter/archive/v2.0.2.zip"
        },
        "php-http/discovery": {
            "version": "v1.14.1",
            "url": "https://github.com/php-http/discovery/archive/1.14.1.zip"
        },
        "geocoder-php/common-http": {
            "version": "v4.4.0",
            "url": "https://github.com/geocoder-php/php-common-http/archive/4.4.0.zip"
        },
        "geocoder-php/yandex-provider": {
            "version": "v4.4.0",
            "url": "https://github.com/geocoder-php/yandex-provider/archive/4.4.0.zip"
        }
    }
}

Note: If you are applying the patch code manually, don't forget to patch the .module file as well.

devad’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new2.28 KB

In this patch:
- Updating the ludwig.json file with the latest library releases.
- Adding the "d8" Drupal Core compatibility argument to the psr/http-client library.

devad’s picture

StatusFileSize
new2.16 KB

In this patch:
- Removing the Ludwig-deprecated "disable_warnings": "TRUE" ludwig.json argument.

Rajeshreeputra made their first commit to this issue’s fork.

rajeshreeputra’s picture

itamair’s picture

Hi 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.

devad’s picture

StatusFileSize
new2.16 KB

Multiple 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.

itamair’s picture

Ok nice. So is the #29 patch RTBC and ready to be committed into code base?

devad’s picture

So is the #29 patch RTBC and ready to be committed into code base?

It'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. :)

  • itamair committed dd44bb0f on 8.x-3.x authored by devad
    Issue #3195238 by devad, Rajeshreeputra, Duvan.Slabbert: Geocoder -...

  • itamair committed a9313055 on 8.x-4.x
    Issue #3195238 by devad, Rajeshreeputra, Duvan.Slabbert: Geocoder -...
itamair’s picture

Status: Needs review » Fixed

Ok, adde this on both 8.x-3.x-dev and 8.x-4.x-dev branches

devad’s picture

Title: Geocoder - Ludwig Integration » Geocoder - Add Ludwig Integration

Thanks @itamair.

I have added the Geocoder project to the Ludwig module ecosystem list.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.