March 2014

For the third year in a row, BuildAModule will be offering our world-class training at DrupalCon. Last year it was one of the highest rated trainings, and this year we aim to make it even better! Registration will be available next week on April 1st, but we wanted to let you know now so you can be ready to sign up before it sells out. The course will is called "Drupal for Beginners", but all skill levels are welcome to join. In fact, the class will work even better with a wide variety of experience levels in the class. To get a sense of the structure of the class, you can read the outline from last year's training.

If you have any questions about the training, just respond to this newsletter. We'd love to have you and your team!

And of course, 5 NEW videos added in "Drupal 8 Developer Prep"

How to convert our pages to use a controller function - 5:16

We explored the idea of controllers in our object-oriented programming section, and here we put our knowledge to good use by creating a controller function to route our pages through.

Updating our routes to include a '_controller' attribute, and what a 'closure' or 'anonymous function’ is - 3:23

In the last video we created our controller function and updated our front controller to use it. In this video we finish up the process of converting to a controller by adding a new parameter to each member of our routing array.

Replacing our app with one that calculates leap years - 2:55

Our ‘hello’ and ‘bye’ pages were good to give our framework multiple pages to work with, but what happens when we have a more complicated application? In this step we replace our simple pages with a page that performs some actual calculations, and we’ll evolve it through the rest of the videos in the Symfony section.

(FREE!) How to create a controller class, and how to tell what are valid PHP callbacks - 2:47

In one of our previous steps we created a controller function to route all of our pages through. In this video we demonstrate how to build a real, genuine controller class (much like what you’ll see in Drupal 8).

How to use the controller resolver and install the Http Kernel component - 3:32

Now that we have our controller set up as a class, we’re going to use a controller resolver (part of the Http Kernel component) to allow for lazy-loading of our controllers. Lazy-loading is always kind of awesome.

I am writing this newsletter after a whirlwind trip to Sweden for DrupalCamp Stockholm. What a beautiful country and awesome people. At the camp were representatives from at least 5 countries, all gathering to celebrate and learn more about Drupal. If any of our state-side members are considering traveling to Europe anytime soon, keep an eye out on the DrupalCamp calendar and consider coordinating your trip around a Camp. It's a great way to make friends and learn where the good restaurants are. ;-)

And 5 new videos this week

How to set up a file to store our routes and use the routing component - 3:23

Now that we have a routing component and are anticipating adding additional pages, it makes sense to split off our routes into a separate file. This will also clean up our front controller, and that will come in handy for purposes to be disclosed at a later time.

Updating our front controller to use the routing component - 2:37

After stashing our routes in their own file, we now need to update our front controller to use the new setup.

(FREE!) How a try ... catch block works and why you would want to use it - 3:04

If you’ve never seen a try … catch block before, it can seem a bit awkward. But, once you understand how it works, it will change the way you debug forever. In this video we go through the basics of using try, throw and catch, but we’ll come back and give the full run-down of try … catch soon.

An in-depth look at how to use try ... catch and throwing exceptions - 5:27

In our last video we explained the role of a try … catch block. In this video we dig deeper and look at the source of the objects that get passed around a try … catch block, how to throw exceptions that don’t get caught, and more.

How to use the routing component to gnerate URLs based on route name, and exploring additional methods of the Matcher class - 4:12

Now that we’re using the routing component, we take a look at a couple more perks we get by using it instead of our custom routing array, including building URLs from scratch knowing just the name of a route.

In these next five videos we continue our dive into Symfony 2 - the framework that Drupal 8 leverages for important tasks like routing, dependency injection and various brands of object orientation. This week we convert our pages to template files and introduce the Routing component - something you'll find invaluable when working with Drupal 8.

Adjusting our pages to use the front controller, and how to add new pages - 2:21

Now that we have a front controller, we modify our ‘hello’ and ‘bye’ pages to leverage it.

Reorganizing our page files to make it easier to add new pages - 2:47

As we anticipate our application growing over time to include more pages, it makes sense to put them in their own directory. In this video we move those files around and update our code to pick up on the new location.

(FREE!) How to convert a PHP file into a template - 3:38

If you’ve ever wondered how templates work behind the scenes, this is the video for you. Here we being a two-part process of converting our PHP pages into HTML with a bit of PHP peppered in where we need dynamic values. It’s not too tough, and it’s a fun technique to incorporate with any simple PHP project.

How to use the extract() function to convert an array to string variables to use in a template - 5:16

In this video we make our template even more template-like by passing simple string variables in. For the magic of getting values out of our objects and into strings, we use the native PHP function, extract().

The weaknesses of our current routing strategy, how to update a Composer project and set up the routing component - 3:04

By this point, we’ve set up a pretty decent framework for our application. We have our routes distilled into an array and can easily add new pages. But, what if we want dynamic URLs that don’r rely on a particular file that has the same name? Exactly! So, in this video we install the Symfony routing component to beef up our routing.

(FREE!) Why using global variables is dangerous, and how Http Foundation solves this problem and allows for extending functionality - 1:56

In this video we talk a bit about how the Request and response wrappers give us more flexibility than accessing our GET and SERVER variables globally, and what the dangers are of using global variables are.

Examples of how we can use the Request class to access variables, and what a reverse proxy is - 7:04

After seeing a simple example of using the Request class, we dig deeper and other things we can do with the Request class, including simulating a request (which is actually pretty neat).

Examples of using the Response class to set status codes, content and content type headers - 3:04

In this video we dig into the Response class and demonstrate how to set a 404 status code and modify the content type header. This might sound a bit dry if you’ve never had to set status codes before, but if you have you’ll notice how concise and simple the Symfony code is.

Adding a second page and an include file for common code - 3:37

Our application is pretty simple so far, and in this video we look at what adding another file would change, and how we can share code between our pages by using an include file. This is a common solution as you start to look at adding flexibility to your code, but we’ll soon identify its weaknesses too.

How to add a front controller - 4:07

We explored using a front controller in our PHP Programming Basics collection, but here we do a quick review and illustrate the pieces we need to route every request to our application through a single file, instead of relying on naming our page files in a particular way.

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.