I need to use some PHP libraries with dependencies but I have some restrictions on the webserver of the client. It is a managed webserver and I can not use a console eg over SSH.
So how do I use now these libraries without Composer?
Can I create some directories manually and what directories or paths do I need to create? Also, what do I need to create so autoloading and namespacing is working?
Can I create the autoload.php somehow manually and what is the content of the file?
It is possible with a simple autoloader and it is not so hard to do it:
But sometimes you have to adjust the
$fileNameso it works with all libraries. It depends on the standard for autoloading and how the class names of the libraries are named. Sometimes you have to split the classname on
_and use the first element for the direcotry name and add this also to the class name. I had for example a second library with a class like
Library_Parserbut the structure was
The first library worked directly with the above code and all classes were automatically loaded.
The code was taken from http://www.sitepoint.com/autoloading-and-the-psr-0-standard/ but I had to correct some code parts (additional underscores and backslashes). I have used the PSR-0 Standard solution.
PSR-4 version by https://.com/users/1740659/thibault: