What is the method for adding a namespace in the lib folder and then instantiating it? Cannot find any documentation on this.
There’s no documentation because anything you add will be autoloaded via PSR-4. If you need to catch up on how namespaces work, this might help.
I guess I don’t know how the root\sage name spacing is working and why I can’t duplicate that with \root\data
I would like to be able to auto load from the lib folder and do things the sage way
@mephilip it’s using PSR-4 to load Classes.
If you look in composer.json you will see;
"autoload": {
"psr-4": {
"Roots\\Sage\\": "src/lib/Sage/"
}
},
To add a namespace and autoload those files, you could do something like this;
"autoload": {
"psr-4": {
"Roots\\Sage\\": "src/lib/Sage/",
"Roots\\Example\\": "src/lib/Example/"
}
},