Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I just wanted to let you know about a blog post I did about your awesome module. That is all.
http://www.agileapproach.com/blog-entry/using-awesome-xautoload-module
Comments
Comment #1
donquixote CreditAttribution: donquixote commentedAwesome!
-------
Ok, I have a few notes.
Don't get me wrong, I am really happy about the post :) just want to clarify a few things.
I know, the module page might also not be in an ideal shape.
--------
About PEAR-NG:
I should mention this is a made-up term, invented by someone in a discussion on drupal.org. Probably noone really uses it outside of the xautoload project page.
Symfony mentions a "PEAR" autoloading convention, where underscores are replaced by "/" (directory separator).
PEAR-NG is the same, but it strips off the prefix that specifies the module name, to get a flat directory structure inside lib/. (*)
----------
Also, in the xautoload implementation for PEAR-NG, your class would be named
sps_Exception_ClassLoadException {}
and not
Drupal_sps_Exception_ClassLoadException {}
At the time I made this design decision, there was not really any standard to speak of in Drupal, and instead classes had just arbitrary names. So I did something inspired by the module name prefix for procedural.
Obviously, there is a point in having the "Drupal_" prefix.
Maybe I should support both - it is easily possible.
-----------
(*) PEAR-NG / PSR-0-NG: Instead of
sps_Exception_ClassLoadException
-> [module dir]/lib/sps/Exception/ClassLoadException.php orDrupal_sps_Exception_ClassLoadException
-> [module dir]/lib/Drupal/sps/Exception/ClassLoadException.phpDrupal\sps\Exception\ClassLoadException
-> [module dir]/lib/Drupal/sps/Exception/ClassLoadException.phpyou just have
.. -> [module dir]/lib/Exception/ClassLoadException.php
This was discussed when PSR-0 was introduced for D8, but in the end people discarded the idea of the flattened directory structure in favor of following the standard.
Btw, in my own projects I would probably name it like
sps_Exception_ClassLoad,
so not repeating the "Exception".
That said, this is really all home-made convention.
---------
Wildcards:
Obviously, the wildcard stuff is only relevant if you keep your awkward class names. If you use PEAR-NG or PSR-0, you don't have to do anything with your info file :)
----------
Finally, it would be interesting how xautoload compares to the symfony class loader. I would expect it to be faster if wired up with many namespaces, but I did not really test.
----
And a small note: blockquote is your friend :)
-----
Anyway, thanks a lot for the blog post!!
Comment #2
indytechcook CreditAttribution: indytechcook commentedI did use blockquotes but the site's styling is TERRIBLE!!!! The inline code didn't work right either.
I'll make the some updates.
Comment #3
indytechcook CreditAttribution: indytechcook commentedQuick note: the project is at LSD/CSI http://drupal.org/project/sps now.
Comment #4
donquixote CreditAttribution: donquixote commentedYou are invited to try the 7.x-3.x branch :)