Hi, is it possible to get this to install using the ludwig module cos I have trouble using composer on my shared hosting.
I've tried, but this is stretching me...
I've created a file called ludwig.json with the following code in:
{
"require": {
"swiftmailer/swiftmailer": {
"version": "v5.4.8",
"url": "https://github.com/swiftmailer/swiftmailer/archive/v5.4.8.zip"
}
}
}
this makes ludwig list:
swiftmailer/swiftmailer
Download the library and place it in modules/swiftmailer/lib/swiftmailer-swiftmailer/v5.4.8
v5.4.8 swiftmailer Missing
but when I try unzipping the file in the folder modules/swiftmailer/lib/swiftmailer-swiftmailer/v5.4.8 it doesn't change from missing. I also tried executing the drush command "drush ludwig-download" but that didn't help either. The files are definitely there in that folder.
maybe I'm missing something...
I also tried putting the files in sites/all/libraries/vendor/swiftmailer/swiftmailer and /vendor/swiftmailer/swiftmailer incase.. but that didn't work either.
ho hum.
composer is tricky when you're using shared hosting.
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | 2920496-29.patch | 2 KB | devad |
| #24 | 2920496-24.patch | 1.98 KB | devad |
Comments
Comment #2
devad commentedI have tried the same as described in #0 and the result is the same.
It would be great if we can make this module to work with ludwig.
Any idea why ludwig fails with swiftmailer library?
Comment #3
devad commentedRelated Ludwig issue.
Comment #4
webflo commentedI looked through the ludwig code base a bit. I think it handles only psr-0, psr-4 style autoloading. But Swift Mailer uses some custom code via "audoload.file".
Comment #5
cybertrail commentedAll the document suggest using Swiftmailer, installed with Composer, but I only have shell access on a few of my customers sites. I can use Composer on these but was glad to find Ludwig for the others. The recommendation to switch to a hosting service that provides shell access is fine but working on many servers, each with their own setup makes, that suggestion impossible. Is there anyway to get Ludwig working for Switfmailer? Luckily Webform PHP Mailer seems to do the job until then.
Comment #6
devad commentedAfter digging a bit deeper into Swiftmailer module composer.json file and composer installation it came to the surface that libraries listed inside module's composer.json file are not the only ones which have to be included into ludwig.json file.
Some other libraries are required by them either directly or indirectly (by their child libraries).
Here is the full list of (currently) required libraries for Swiftmailer module installation from composer report:
- Installing symfony/css-selector (v5.1.6): Downloading (100%)
- Installing tijsverkoyen/css-to-inline-styles (2.2.3): Downloading (connectinDownloading (100%)
- Installing swiftmailer/swiftmailer (v6.2.3): Downloading (100%)
- Installing html2text/html2text (4.3.1): Downloading (100%)
So, all these libraries should be added to
ludwig.jsonfile in order for Swiftmailer module to work nicely in full capacity.Additionally, a few lines of code should be added to .module and .install files as manual integration for swiftmailer library.
Update: See and test patch #11.
Comment #7
devad commentedComment #8
devad commentedComment #9
devad commentedComment #10
devad commentedUndo. :)
Comment #11
devad commentedHere is the patch which is enough to add Ludwig integration into Swiftmailer module.
Ludwig does not have full support for 'files' autoload type libraries yet. But I have tested, and with adding few lines of code into into
swiftmailer.modulefile and intoswiftmailer.installfile the integration works well.I have edited my previous comment #6 accordingly.
It would be nice to help all Drupal users who are not familiar with Composer yet and give them an alternative... but let's see what the maintainers of Swiftmailer module will decide about adding Ludwig integration to Swiftmailer module officially.
Maintenance of this integration should be relatively easy. When the new versions of libraries are required the ludwig.json file should be updated, and if the new version of swiftmailer library is required then the update of
swiftmailer.modulefile andswiftmailer.installfile is needed as well. It takes 10-15 min only to synchronize all these files with new composer.json file every few months when new library requirements are needed, so it should not be a lot of work for module maintainers.Update note: The D9.1 tests failed because of the branch fail.
Comment #12
devad commentedThe new
"disable_warnings": "TRUE"ludwig.json option is added to just released Ludwig 8.x-1.2.Swiftmailer can use it nicely to disable "Classmap" warning for manually implemented integration.
Comment #13
devad commentedInterdiff.
Comment #14
devad commentedIgnore this one. Test patch #17.
Comment #15
devad commentedInterdiff.
Comment #16
devad commentedMoving "if Ludwig module exists" part of code to the Helper function for simplicity reasons.
Comment #17
devad commentedMoving the Ludwig Helper function 'ludwig_require_once' to new ludwig.inc file so that any script (.module, .install) can require it once.
When library requirements are upgraded (in some future release), the only file which needs sync with new library versions now is the ludwig.json file. This makes job for Swiftmailer module maintenaires easy.
BTW... congratulations for #2223967: Do not decode a contact message twice.
A note for Swiftmailer module maintainers
My vote is to add official Ludwig integration to Swiftmailer module before stabile Swiftmailer 2.0 release. So that all Drupal 8/9 users who are not familiar with Composer can use Swiftmailer module still (with Ludwig).
Ludwig module has nice and very detailed documentation added to Drupal.org recently.
Ludwig is improved a lot in last 2 months, including stabile D9 release.
It has 6700+ users currently and very steady Weekly usage increase despite opinions that "Everybody is using Composer nowadays". :)
Comment #18
devad commentedIt seems that Swiftmailer module branch tests have some issues with latest Drupal Core .dev releases which need a fix: #3182622: Fix 2.x branch tests
Comment #19
devad commentedWith #3182622: Fix 2.x branch tests fixed, tests here are working well also.
Patch #17 is ready for further reviews.
Comment #20
rroose commentedHi devad,
Thanks for all the work so far. All the libraries work except for the Swiftmailer library:
/contrib/swiftmailer/lib/swiftmailer-swiftmailer/v6.2.3Ludwig keeps saying it's still missing even though it's placed in the right directory. Any idea why that one is not working?
Comment #21
devad commentedRe: @rroose
Please, update your Ludwig module to latest 8.x-1.4 version if you didn't do so already.
Swiftmailer 8.x-2.x-dev + Patch #17 in combination with Ludwig 8.x-1.4 should not give you any 'missing' libraries messages.
Please, try and post back your result.
Comment #22
rroose commented@devad
That fixed the issue, many thanks.
Comment #23
devad commentedWelcome. Thank you for reporting back @rrose. Marking RTBC as per comment #22.
Comment #24
devad commentedIn Ludwig ver. 8.x-1.5 a new Ludwig service is added which can be used instead of ludwig.inc file here.
The 'files' and 'classmap' libraries integration with Ludwig are more simple now.
New patch attached.
Comment #25
devad commentedPatch #24 is a new approach using new ludwig.require_once service. So, no need for interdiff.
Libraries are updated to latest versions as well.
Comment #26
CPxiom commentedThis works, swift mailer was installed without problems. Using Drupal 9 with php .
Thank you for this integration patch.
I really wonder why ludwig is not a standard for drupal modules. It feels native to drupal.
Or maybe on Ludwig side, it would be nice to be able to read what is needed, maybe from composer.json? I'm not a coder btw.
Thank you for this.
Comment #27
CPxiom commentedComment #28
devad commentedThanx for review and RTBC report @CPxiom. Appreciated.
Ludwig has its limitations. So, I do not see it being ever added to core.
However, with all its limitations it can still help a lot if some Drupal users are not familiar with Composer yet.
Read more about Ludwig limitations in the FAQ section of this guide. The target of this FAQ section are contrib module developers... so it is a bit technical talk. :)
Comment #29
devad commentedPatch reroll for new Ludwig 8.x-1.6 (due to slight service API change).
#2914840-20: Add support for 'classmap' and 'files' autoload types
One line interdiff in both .module and .install files:
Comment #30
joshuautley commented#29 worked perfectly for me. Thank you!
Comment #31
devad commentedThanks for review. RTBC confirmed as per #30.