Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP PHP Standards and Best Practices Autoloading and Composer Composer

Where is PSR-4 episode?

Phil mentioned episode covering PSR-4. (at http://teamtreehouse.com/library/standards-and-best-practices/autoloading-and-composer/composer ) But I can't find next episode. Where is it?

1 Answer

Andrew Shook
Andrew Shook
31,709 Points

I just finished the course and didn't see anything else about PSR-4. You can check out the documentation here. Mostly, PSR-4 is exactly like PSR-0, but underscores in the name space no longer represent directories. For example:

<?php
// PSR-0 namespace with underscores
use \namespace\package\Class_Name 
// gets file at /path/to/project/lib/vendor/namespace/package/Class/Name.php

//PSR-4 namespace with underscore
use \namespace\package\Class_Name 
// gets file at /path/to/project/lib/vendor/namespace/package/Class_Name.php

Hope this helps.