News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Test.ical.ly Blog:
PHP 5.3 and the Symfony2 UniversalClassLoader - Where to load?
January 14, 2011 @ 11:21:00

In doing some work on a project of his, Christian came across the need for some autoloading in his libraries. His search lead him to the Symfony autoloading tool the UniversalClassLoader.

I'm not yet sure what is the best approach to use this loader. When I started looking for examples I sent a small tweet which was replied to by Stefan Koopmanschap as he used this class loader in one of his own libraries. What he did is to include the class/namespace registering code in one of the central classes of his library. If you take a look at my code you will see the same approach.

He decides that the library itself shouldn't try to do the autoloading itself. It should always assume that there's something in place to load the files/classes it needs to get the job done. The UniversalClassLoader is prefect for this but, in his option, shouldn't be a part of an application's functionality (see his commit here removing the autoloader).

1 comment voice your opinion now!
symfony2 universalclassloader autoload opinion


blog comments powered by Disqus

Similar Posts

Cal Evans' Blog: How do I find good PHP developers?

Symfony Blog: New in Symfony 2.2: The new fragment sub-framework

Artur Ejsmont's Blog: A few words on bugs and software quality

Mike Wallner's Blog: Upgrading to 5.2

Joris de Wit's Blog: Extending different layouts for Ajax requests in Twig, Symfony2


Community Events





Don't see your event here?
Let us know!


language framework deployment introduction conference tips release podcast community bugfix laravel zendserver series threedevsandamaybe api interview list symfony code voicesoftheelephpant

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework