<?php
// include loader class - it's necessary :(
require_once 'classes/Loader.php';
// create new loader instance
$loader = new Loader();
// set loader's include paths, files extensions and register it
$loader ->setIncludePath('classes/')
->setFileExtension('.php')
->register();
// create new \MyPackage\Test instance (autoloading works! :D)
$test = new \MyPackage\Test();
// do something with an example class
$test->setText('This is an example string.');
var_dump($test->getText());
|