Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Browse all series

Write a Composer Package With Me

If you'd like to come along for the ride, I need to build a small package for Laracasts to handle the loading and processing of a transcripts file. The ultimate goal is to provide a pretty slide-out panel to quickly scan and read the full transcript for a given lesson. Even better, when you click any relevant sentence, it will take you to the exact portion of the video where that line is spoken.

In this series, we'll use test-driven development to drive the backend PHP portion of this new feature.

Progress

Series Info

Episodes
7
Run Time
1h 20m
Difficulty
Intermediate
Last Updated
Aug 31, 2021
Version
PHPUnit 9.5.8

Series Episodes

  1. Episodes (7)
    1. Terms, Package Configuration, and the First Test

      To get the ball rolling, let's initalize Composer, pull in PHPUnit, and then prepare the configuration for the project. We'll then finish up the lesson by writing the first simple test we can think of.
    2. Load the Transcript as an Array

      Next up, it would be useful if we could organize the transcript into a list, or array. With that in mind, let's introduce a new lines() method.
    3. Introduce a Line Object

      In this episode, we'll extract a Line class that can be responsible for all behavior and manipulation that is specifically related to a single line of dialogue.
    4. Render a Transcript as HTML

      It might be useful to offer the ability to render the loaded transcript as HTML, including clickable links to each timestamp. Let's play around with a possible implementation in this video.
    5. Final Squint Test Before Publishing

      I think we're just about ready to push this up to Packagist. But before we do, let's do one last squint test and perform any lingering refactorings. I think I can see a few places where we might improve the structure of the code.
    6. Tag and Publish to Packagist

      I think we're now ready to tag our first 0.1.0 release. In this lesson, we'll create a new GitHub repository, push our code up to it, and then add it to Packagist.org.
    7. Prepare a Minor Release

      At this point, our package is available to anyone in the world - including me. As I've been working with it behind the scenes, I've come across a few small snags that need to be ironed out. In this episode, we'll add a couple small features and then tag a new minor release.

Continue Learning