New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Namespace+Autoloading compatibility #120
Conversation
@WietseWind thanks for pointing it out. This was mentioned before in #80 Not sure how to make the transition yet. |
@serbanghita The great thing about my suggested fix is it's on top of de current, unnamespaced, un-autoloadable class; it just namespaces and extends the current class. Without any changes people can choose to use the (unchanged) unnamespaced version, or the namespaced, autoloadable one. |
@WietseWind I planned to respond earlier but god distracted. So, I got it now, I was missing the context. Is there anyway you can provide a real world example. I'm interested in explaining the new folder to people. How this changes the integration of the script into Symfony. Thanks! |
Hi @serbanghita, The Symfony Classloader makes auto-loading classes very easy;
|
You may want to use slashes instead of DIRECTORY_SEPARATOR, they work in windows too. |
@vlakoff I don't see no reason to replace |
I just think it is a true pain to read :-p (which leads to worse maintainability) This article has made a perfect summary. That being said, we don't want to go off-topic ;-) |
Good change! I started using your code inside Symfony2, and it's working! Greetings! |
@DaniSancas Great :) |
Added Namespace+Autoloading compatibility
I'll tag this in the |
Great, thanks! |
Another small thing, since PHP 5.3 is required, you are sure the |
Little piece of PHP to make Mobile_Detect auto-loadable in PSR-0 compatible PHP autoloaders like the Symfony Universal ClassLoader by Fabien Potencier. Since PSR-0 handles an underscore in classnames (on the filesystem) as a slash, "Mobile_Detect.php" autoloaders will try to convert the classname and path to "Mobile\Detect.php". This script will ensure autoloading with: