composer-drupal-lenient
                                
                                 composer-drupal-lenient copied to clipboard
                                
                                    composer-drupal-lenient copied to clipboard
                            
                            
                            
                        Add service provider, try to influence Drupal runtime parsing of core_version_requirement
Folks who need this might want to try https://www.drupal.org/project/backward_compatibility
Huh, so this is the magic.
/**
 * Implements hook_system_info_alter().
 */
function backward_compatibility_system_info_alter(&$info, Extension $file, $type) {
  $info['core_incompatible'] = FALSE;
}
Ah but it's invoked within the ExtensionList which is impossible to decorate. https://git.drupalcode.org/project/drupal/-/blob/11.x/core/lib/Drupal/Core/Extension/ExtensionList.php#L322
And it's a bit risky (maybe) to decorate the module handler and manually inject our own hook.
Another way would be to do a drush :) And add system_system_info_alter() in a file and include that file via composer. It does something similar with a log hook I think.
FWIW this is something that hopefully hooks as PHP Attributes will allow us to solve nicely.
Until (or if) this becomes possible, perhaps we could link to https://www.drupal.org/project/backward_compatibility in the README, since composer require and drush install go hand in hand?
Drupal now uses OOP hooks. So I think this can be done now for 11.x!
Fantastic! It would be awesome if all that's needed to bypass version constraints for both Composer (download) and Drush/GUI (install) is Drupal Lenient Composer Plugin.