Problem/Motivation
Hi,
Regarding https://speakerdeck.com/mamoot/drupal-and-php-performances?slide=15, I am currently testing this module to avoid to have a serialization code snippet to write in all my projects.
Thanks a lot for this module!
Unfortunately, unlike the Redis module, this one is currently not ready to be used even if the module is uninstalled.
Steps to reproduce
In settings.php add instructions like:
$settings['container_yamls'][] = 'modules/contrib/igbinary/igbinary.services.yml';
$settings['container_yamls'][] = $app_root . '/../conf/drupal/igbinary.services.yml';
With the module not installed.
Proposed resolution
Add psr-4 instructions inside composer.json.
Remaining tasks
Create a MR.
Comments
Comment #3
grimreaperMR created.
Uploading patch for easier Composer usage.
Thanks for the review!
Comment #4
grimreaperFYI, because autoloader generation is not impacted by the patch (I guess the change should be merged to have an impact), in my project composer.json I have added the following configuration:
Comment #5
mkalkbrennerI'm sorry but I don't understand what you mean.
Can you explain the issue more detailed?
Comment #6
grimreaperOf course, re-reading my sentence, it was not clear.
Currently to use Igbinary you have to enable the module because even if including manually the services.yml file in settings.php, the classes are not in the Composer autoload.
Whereas in Redis module there are psr-4 instructions in the composer.json which allow to download the module with Composer and just by including manually the services.yml file in settings.php you can use Redis without having to enable the module.
With the proposed changes, it will be possible to use Igbinary by manually including its services.yml in settings.php and use it without having to enable the module.
Comment #7
socialnicheguru commentedThis is great.
I made the assumption that Redis and Igbinary modules worked the same way and wasted a few hours yesterday trying to figure it out.
Thank you for this.
Comment #8
socialnicheguru commentedComment #9
socialnicheguru commentedEdit: I definitely had to add the $class_loader line
---
With Redis, it is suggested that this line is added to my local.settings.php file
$class_loader->addPsr4('Drupal\\redis\\', 'modules/contrib/redis/src');It is in https://www.drupal.org/project/redis/issues/2876132
I think we have to do the same for igbinary too.
$class_loader->addPsr4('Drupal\\igbinary\\', 'modules/contrib/igbinary/src');Comment #10
grimreaper@SocialNicheGuru Thanks for the feedbacks.
But I have been using Redis for years, also during Drupal installation (when it is not enabled yet), without the mentionned line:
Since the first version of the D8+ Redis module, the following lines are present in the composer.json file of the Redis module:
So when getting the Redis sources with Composer the autoload is automatic.
Those are the same lines that I want to add in the composer.json of igbinary. Otherwise until it is merged, you can change the composer.json of the project using the module with the lines from comment 4.
Maybe if you are not using Composer to download Redis then the $class_loader stuff is required but It should only be something documented. And currently in Redis it is only used in a test because I guess in the tests the sources are not handled with Composer.
Comment #11
socialnicheguru commentedI am using composer.
Honestly I just followed directions.
I will try it without the lines and I will report back
Comment #12
socialnicheguru commented@Grimreaper, you are right. I did remove the lines i thought I needed in #9 from my local.settings.php file and it still worked.
Comment #13
socialnicheguru commentedComment #15
grimreaper