Created
          April 30, 2025 21:41 
        
      - 
      
- 
        Save aklump/a1bd4a5b6009b1d080cf2e66f993c46f to your computer and use it in GitHub Desktop. 
    snippet to load composer autoload
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // https://getcomposer.org/doc/articles/vendor-binaries.md#finding-the-composer-autoloader-from-a-binary | |
| if (isset($GLOBALS['_composer_autoload_path'])) { | |
| // As of Composer 2.2... | |
| $_composer_autoload_path = $GLOBALS['_composer_autoload_path']; | |
| } | |
| else { | |
| // < Composer 2.2 | |
| foreach ([ | |
| __DIR__ . '/../../autoload.php', | |
| __DIR__ . '/../vendor/autoload.php', | |
| __DIR__ . '/vendor/autoload.php', | |
| ] as $_composer_autoload_path) { | |
| if (file_exists($_composer_autoload_path)) { | |
| break; | |
| } | |
| } | |
| } | |
| $class_loader = require_once $_composer_autoload_path; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment