for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Darya\Foundation\Providers;
use Darya\Common\Autoloader;
use Darya\Service\Contracts\Container;
use Darya\Service\Contracts\Provider;
/**
* A service provider that provides an autoloader for application classes.
*
* @author Chris Andrew <[email protected]>
*/
class ClassLoaderService implements Provider
{
* Register an autoloader for application classes.
* @param Container $container
public function register(Container $container)
$configuration = $container->resolve('Darya\Foundation\Configuration');
$basePath = $container->get('path');
$namespace = $configuration->get('project.namespace', 'Application');
// Map the configured namespace to the application directory
$autoloader = new Autoloader($basePath, array(
$namespace => 'application'
));
$autoloader->register();
$container->register(array(
'Darya\Common\Autoloader' => $autoloader
}