Posts

Showing posts from April, 2015

PSR-0 and PSR-4 autoloader for php 5.4 on linux

The PHP build-in auto-loader can't handle namespace paths on Linux.

It also seems to have issues with case.

The easiest way is to lower-case all class files, and add a file containing the following code and include it.
<?php
spl_autoload_register(
  function ($pClassName) {
spl_autoload(strtolower(str_replace("\\", "/", $pClassName)));
  }
);
Source: http://php.net/manual/en/function.spl-autoload-register.php#111875