For a simple case like this, the fastest solution creates a folder (like Common ) directly under src and puts its class in it.
src -- Common -- Tools.php
Tools.php contains your class with the correct namespace, e.g.
<?php namespace Common; class Tools { public static function slugify($string) {
Before calling your function, do not forget the use statement
use Common\Tools;
If you put your code under src following the correct folder structure and namespace as mentioned above, it will work without touching app/autoload.php .
mgiagnoni
source share