7 days of WordPress plugins, themes & templates - for free!* Unlimited asset downloads! Start 7-Day Free Trial

Next lesson playing in 5 seconds

  • Overview
  • Transcript

2.2 The Sample Application

To make the course as hands-on as possible, we’re going to build a simple application, based on a stripped-down version of my podcast site Free the Geek.

In this lesson, I’ll give you an overview of the static site generator and explain our approach to implementing it with SPL iterators.

Related Links

2.2 The Sample Application

To make the course as practical and as hands on as possible, we're going to build or build on a sample application. One which is based on the clone source repository which is a podcast site. The application isn't too sophisticated. Actually it's a rather stripped down version of my podcast website. Which is Free the Geek.fm. Here's how the application will work. Instead of using a database, which you might typically expect to do so to store and retrieve episode data, the application which we'll create instead uses static text files. These files contain a combination of YAML front matter And a markdown body. Let's have a quick look at a sample file. In this example, you can see that the YAML front matter contained all of the metadata about the episode. Such as the release date, slug, guests, and extract, and the markdown contains all the readable information. Such as show notes, related links, author bio, and so on. To retrieve the files, the application will iterate over a file system directory. Retrieving only the episode files and skipping any anything and everything else which might be contained there. Once it's done that it then hydrates one or more value objects from the information contained in the retrieved files. After the objects are hydrated the data can then be presented to the user in a series of ways. Specifically showing them upcoming and past episodes. This way listeners can get excited about what's coming up, listen to the latest episode, and peruse the back catalogue. Assuming that they're coming in midstream. The code which we'll create will do all of that using only SPL iterators plus some other SPR constructs. Now this might sound simple on the surface of it but quite honestly there is a bit to it. If you start browsing through some of the sample code available in the cloned repository. You'll see that it makes use of a few other libraries, such as Twig. Whilst they're not strictly necessary to create the application. They're helpful to make the process of creating it, much simpler and much more efficient. I just want to digress for a second. I'm the kind of person who believes in not doing more than is necessary. Particularly when it comes to development, and this specifically includes not reinventing the wheel. So wherever possible I make use of existing libraries which provide the functionality which my applications need, instead of doing it myself. And that's it for this video. In the next video, We're going to get a basic introduction to the standard PHP Library.

Back to the top