php - Define custom paths for some classes when using PSR-4 composer autoload -


i'm using composer autoload,but classes not adhere namespace structure have exist in global namespace. what's best way that?i specify them in "files" section, eb loaded on every request. have class wc_product_whatwever that's inside includes/xxx must reamin in global namespace woocommerce work

"autoload": {     "psr-4": {         "xxx\\theme\\": "includes/xxx"     },     "files": [         "includes/template-tags/navigation.php",         "includes/template-tags/styleguide.php"     ] }, 

you can use classmap autoloading:

{     "autoload": {         "psr-4": {             "xxx\\theme\\": "includes/xxx"         },         "classmap": [             "includes/template-tags/"         ]     } } 

for reference, see https://getcomposer.org/doc/04-schema.md#classmap.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -