addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Namespaces and Autoloading

  • Jan 23, 2014 · 7:00 PM
  • ITT-Tech

Talk:
Want to make sure that your class names don't overwrite the class names for any other projects on the server? Hate having long class names like [insert ridiculously long classname here]? Namespaces were introduced in PHP 5.3 to help address these common issues. Learn how to namespace classes and see how namespaces and class autoloading can make your coding experience much nicer!


Speaker:
Beau Simensen has been working with PHP since 2002. Professionally, he offers consulting services through his company Dragonfly Development (http://dflydev.com/). Beau is a proponent of writing framework agnostic code and hopes to help projects embrace a life not completely tied to any framework's ecosystem.


After the Talk:
Head over to the Badger Bowl (across the street and down a block) and join us for some extra networking time and some friendly conversation.



Join or login to comment.

  • Chris T.

    Learned a lot. Thanks Beau.

    1 · January 24, 2014

  • Beau S.

    Hey all! I'm going to try to not spam this list too much, but I wanted to share the code that I showed last night that we weren't sure worked in PHP prior to version 5.5.

    I mentioned this awesome tool that compared PHP versions but I couldn't remember what it was called. I checked it out just now and it is 3v4l.org ( "eval.org") ... now that I know what they were going for it will be easier for me to remember. I just know there was a 3, a v, and a 4 in it somewhere. :)

    Anyway, here is the code from my slide so you can see how it behaves in all stable PHP releases. From what I can see, this could SHOULD work in any version of PHP that supports namespaces.

    http://3v4l.org/5jdha

    In any event, this is a really nice utility that allows you to check behavior of isolated chunks of code against many versions of PHP. :)

    January 24, 2014

  • Derek B.

    As a developer of a lot of "legacy" style PHP code this talk sparked some ideas of how to modernize my development.

    1 · January 24, 2014

  • A former member
    A former member

    Informative & helpful. It was a treat to have a FIG member present!

    1 · January 24, 2014

  • Beau S.

    Thanks to everyone who came out! I had a lot of fun preparing for this presentation so I hope it was both useful and entertaining for you! It was great to see a lot of interaction from the crowd, too, so thanks for asking questions and getting involved!

    But for those of you who said my __autoload slides were wrong, you were wrong and you should feel bad. Wait, no, you were right! ;) D'oh!

    If you care about absolute correctness in something that I hope none of you ever actually have to work with please check out slides 87-90 for the correct use of __autoload. :)

    I love feedback, even if you say I'm wrong! I think it was Andrew and Daniel who mentioned the __autoload error. THANKS! If someone else was in on it, let me know and I'll thank you, too!

    As for the slides, last night I said they were on speakerdeck but I just found out I forgot to make them public. My bad! You should be able to see them here now:

    https://speakerdeck.com/simensen/namespaces-and-autoloading-madison-php-2014

    January 24, 2014

  • Andrew S.

    Beau did a great job explaining the not just the use cases, but also best practices and the history of namespaces and autoloading. Very interesting even for someone who's already using namespaces and autoloading in their projects.

    1 · January 24, 2014

  • Jordan T.

    Good to see everyone, thanks Beau for the presentation!

    1 · January 24, 2014

17 went

Our Sponsors

  • O'Reilly

    Get 40% off print books and 50% off ebooks. Use code DSUG.

  • O'Reilly

    Buy 1 Ebook, Get 1 Free with your user group discount code: DSUG2

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy