Demystifying the Craft CMS API

Author
Prateek Rungta
Published
Event
Dot All 2023
Location & Date
·Barcelona, Spain

The Pixel & Tonic team were kind enough to invite me back on the Dot All stage1 to share some of our learnings with a room full of people in Barcelona. This time, I spoke about leveraging some of the power and tools that Craft already ships with — filters, functions, collections, helpers, services, caches, and much more — right from within Twig.

The talk covers three broad areas:

  • We start by looking at the benefits of leveraging Craft (and Yii) APIs in general and the ways in which that makes us more efficient developers, and our code more reliable and performant.

  • Having established the why, we move on to examining commonly occurring scenarios during the development lifecycle and identifying patterns where we can start falling back to and integrating more of the API.

  • In the third and final part, we look at ways to identify the appropriate Twig filters and functions, or Craft helpers, services, and components that can be plugged in these scenarios.

Demystifying the Craft API for Twig Developers by Prateek Rungta on Vimeo.

In order to demonstrate some of these more richly with relatable examples, I created a bare-bones site for a fictional Dot All Music Festival. The code for this site is up on GitHub.

Prateek speaking at Dot All 2023 Audience listing to the "Demystifying the Craft CMS API" talk at  Dot All 2023

Photographs from the event. 

This talk is based upon my own developer journey using Craft CMS over the years. I also drew from the experience of witnessing first-hand the individual development journeys of my teammates, and spotting common patterns between their paths and my own.

I hope this helps you discover and use more of the powerful tools available to use inside a Craft CMS Twig template file. email hidden; JavaScript is required if you found any of the techniques useful or discovered something new that you could use.


  1. We have previously delivered talks on Fortifying Craft CMS for High Traffic at Dot All 2019 in Montréal, and Modular Architecture for Building Content Websites at Dot All 2018 in Berlin. â†©ï¸Ž