Closed judgej closed 8 years ago
Something like this works in the autoloader in my dev env:
spl_autoload_register(function($class) {
if (stripos($class, 'Teapot\\') === 0) {
include(
__DIR__ . '/../vendor/shrikeh/teapot/src/Teapot'
. str_replace('\\', '/', substr($class, strlen('Teapot')))
. '.php'
);
}
});
Note that this does not autoload Teapot's dependencies.
However, that makes assumptions about where the vendor directory is, and that there even is a vendor directory, and how that relates to location of this package. Too many assumptions.
We'll leave the autoloader for this package in, but the Teapot package will need to be set to autoload externally; we don't car how, so long as it is available.
This was added when considering running this package in a non-composer environment. Now it has a dependency on
shrikeh/teapot
, which in turn requiressquizlabs/php_codesniffer
, use without composer is going to be a lot more difficult.We should either remove the built-in autoloader, or remove composer library dependencies. Or maybe extend the built-in autoloader to autoload
Teapot
if it is installed alongside this package? It does not look likesquizlabs/php_codesniffer
is needed by any of theTeapot
interfaces that we use.