December 2013

The Drupal 8 Developer Prep series picks up again with a look at some PHP coding standards. We'll continue to work with our Autoloader and explain why it's to our advantage to make sure it complies to the PHP Standards Recommendations (PSR) set out by the Framework Interoperability Group (FIG).

4 NEW videos added in "Drupal 8 Developer Prep"

(FREE!) What FIG (Framework Interoperability Group) is and why PSR-0 (PHP Standards Recommendation) exists - 1:32

Autoloading becomes much more powerful if all of the libraries you use expect the autoloader to work in the same way. To solve problems like creating standards around autoloading, the Framework Interoperability group was created, and the first recommendation they put out was to solve this particular problem.

How to build a PSR-0 compliant autoloader, and a walkthrough of PSR-0 requirements - 8:43

PSR-0 has a cryptic sounding name, and the fact that it took a bunch of really smart people coming together to create it might imply that it should be dauntingly complicated, but it's not. In this video, we walk through each of the conditions and build an autoloader that fits the bill.

Why it's good to use an established autoloader instead of creating your own - 1:24

Even though the basics of autoloading are simple and we can build one on our own, there's some serious gains to be made by using a more mature autoloading solution. We talk about that a bit in this video.

How to make our own project PSR-0 compatible - 4:44

To wrap up our OOP boot camp, we're going to take our own components and make them far more useful by conforming them to PSR-0 standards. What we end up with is going to look a lot like the code we built in our first Drupal 8 module example, but this time the structure is going to make a lot more sense.


The BuildAModule Team wishes you and your loved ones the happiest of holidays this year. And for those of you who want to give or give the gift of learning, we have a little something to help you do just that! Use the code HOLIDAYS2013 any time over the next three days to get 25% OFF 6-month and 12-month memberships, or just click on any of the links below to take advantage of this special offer.

Get 25% OFF a 6-Month Membership

Get 25% OFF a 12-Month Membership

The Drupal 8 Developer Prep series keeps on trucking with a more in-depth look at Autoloading. This week, we're going to create a simple Autoloader and walk you through each line of code as it executes! We'll also take a quick look at a more likely third party scenario in order to get a better idea of what the structure of a typical third party PHP library is like.

3 NEW videos added in "Drupal 8 Developer Prep"

(FREE!) How to create a simple autoloader - 2:24

Now that you know what an autoloader is, we look at how to create a simple autoloader. We'll build on this in videos coming up, but this should give you a clear sense of how it works and dispel what seems like magic when you haven't looked under the autoloading hood.

Walking through our simple autoloader with a debugger - 2:02

Just to drive home how our autoloader works, we step through the code line by line as it executes to see exactly what's going on.

How a typical PHP library will be structured and what each of the nested folders mean - 3:12

One of the most obvious changes introduced while building a module in Drupal 8 is the incredible nest of directories in which we need to work. Each directory has a purpose, and many of them are tied in with the autoloading conventions being used. In this video we walk through each level and explain what's going on.


This week, we demystify more of the magic behind Namespacing! And as we summarize all of its benefits, this journey naturally leads us into Autoloading territory. The Drupal 8 Developer Prep series continues with a look into this memory saving technique.

4 NEW videos added in "Drupal 8 Developer Prep"

How to use namespace aliases with the "as" keyword - 1:14

One way we can get access to both classes of the same name at the same time is by using aliases. Again, we avoid the problem of re-naming our classes (which is one big payoff of namespacing) and instead use an alternative name for one of our classes.

How to use a Fully Qualified Name for classes and methods - 1:32

A finally method we can use to reference a class that we've included in our code is by using a Fully Qualified Name. When we use a Fully Qualified Name, we don't need a "use" statement at all, but calling our classes is going to take a few more characters. Nothing we can't handle.

The benefits of namespacing and a summary of how namespaces work - 1:58

Now that you've seen namespacing in action and explored the most important mechanics of it, we take a step back and talk briefly about what we're really getting out of namespacing. On the surface, it can seem like a lot of extra code for not a lot of benefit. But, in addition to finally being able to name our classes according to exactly what they do, there's some other perks you should know about.

(FREE!) What "autoloading" is and how namespacing relates to it - 2:12

One thing that namespacing allows us to do is use an autoloader to include our class files on-the-fly whenever we instantiate them or use a method from those classes. Autoloading is pretty dang cool and allows us to simplify our code by removing unnecessary include or require statements.


Cyber Monday Deal Extended! 30% OFF ANYTHING!!

If you missed out on our Cyber Monday deal yesterday, then you're in luck. We're extending the savings for another 24 hours so that our Newsletter subscribers can get in on the action. Get 30% off anything at BuildAModule by using the code CYBER2013 when checking out!

A New Chapter Begins! An Introduction to Namespacing...

Today marks the start of a new chapter in our Drupal 8 Developer Prep series. We're going to be doing a bit of work with Namespacing over the coming weeks. To start things off, we'll show you how it can be used to avoid some major headaches when you're working on a project with naming conflicts.

5 NEW videos added in "Drupal 8 Developer Prep"

How to split a single large file into individual class files - 4:43

So far we've been building our entire project in a single file to make it easy to review. For sustainability and re-usability, though, eventually every mega-file needs to be split up into separate components. In this video we talk about the specifics of splitting things up.

How to name class files - 1:03

There's a lot of freedom in how you can name classes and class files, but by following a couple simple conventions, you'll pave the way for easier integration with other components later on.

How using third-party libraries or working on a team can create naming conflicts - 3:03

Have you ever spent a bunch of energy building an important component to your project, only to realize later that there's a more mature third-party library that will fit the bill? And then, when you try to use it, you realize that it uses the same class name as your component? Even if your answer is no, it's something you'll run into eventually, and it's good to have a solution at the ready.

(FREE!) How to use namespaces in PHP - 7:11

In this video we walk through the mechanics of namespacing, including how we reference namespaced classes and use other namespaces. The basics seem simple, but if wrapping your mind around namespaces has ever set your head swimming, the tangible examples in this video should help clear things up.

How to use namespaces to avoid naming conflicts - 2:34

How to use namespaces to avoid naming conflicts">

After looking at the implementation of namespacing in the previous video, we look at how it makes using including our third-party class along with our identically-named self-made class possible without altering any names or adding gobs of unearthly prefixes.


Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:

Contact us

Below are the supported keyboard shortcuts for our video player.

Start / stop video
Go to next video
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
Jump to a percentage (2 is 20%, for example)
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
1 month
6 months
10% off
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.