dripping paint

Version 2

Learn how to create
a Laravel package

Start this course now and publish your first package today

Having produced over 300 packages with more than 900 million downloads in total, the Spatie team knows what they're talking about.

Dive in the mind of the people that brought you quality packages like laravel-permission, laravel-backup, browsershot, laravel-medialibrary and learn how to program, test, and maintain your very own packages.

Screenshot Watch introduction

Become the next package maestro

139 USD

Buy the complete course

What you'll learn:

  • Building a framework agnostic PHP package
    Basic structure, testing, GitHub actions, Packagist, …
  • Building a Laravel package
    Build a real Laravel package from scratch
  • Source dive Spatie packages
    Get a tour of real life examples

See the entire table of contents

Version 2

  • Vastly improved workflow
  • Examples updated to use the PackageServiceProvider
  • Suitable for PHP 8.x, Laravel 8,9,10 and 11
  • Using modern GitHub action workflows to run tests, update changelog and more
  • Testing via Pest and PHPUnit
  • Videos now in glorious 4K

Course overview

4 hours of content

For all functionality that is added to a package, you'll learn how to automatically test it, both locally and via GitHub Actions. This way you can build a beautiful and maintainable package that your co-workers, clients, and the community can rely on.

All videos are available in our online course environment, where you can track your progress.

Screenshot Watch example
  1. Building a framework agnostic PHP package

    • Using the Spatie PHP package skeleton to get started building an agnostic package
    • Adding a first class to the package
    • Testing a package using Pest and PHPUnit
    • Automatically fix code style issues locally
    • Running the tests on GitHub actions
    • Fixing code style issues using GitHub Actions
    • Supporting multiple PHP versions
    • Using semantic versioning
    • Keeping a changelog
    • Automatically updating the changelog
    • Registering the package on Packagist
    • Publishing a new release on GitHub
    • Taking care of community contributions
  2. Building a Laravel package

    • Using the Spatie Laravel package skeleton to get started building a Laravel specific package
    • Using the specialized Package Service Provider
    • Adding a config file to the package
    • Adding an artisan command
    • Adding models and migrations to the package and how to automatically test them
    • Adding routes, controllers and views in a way that they don't conflict with application routes
    • Running the tests of the Laravel package on GitHub Actions
    • Using MySQL in the package tests and on GitHub Actions
    • Testing artisan commands using PHPUnit and Orchestra Testbench
    • Testing routes, controllers and views
    • Supporting multiple PHP and Laravel versions of your package
    • Developing a Laravel package inside a full Laravel application
    • A whopping 90 minute live coding video where we bring together the knowledge of the entire course to build a real life package from scratch. Watch Freek code and explain his thought process.
    • Converting an old style service provider to a Package Service Provider
  3. Source diving Spatie packages

background pattern
Jonathan Reinink
Jonathan Reinink @reinink

… If you're looking to sharpen up on your Laravel package skills, you're not going to find a better resource than this. 👌

Sander van Hooft
Sander van Hooft @SandervHooft

… I had to reverse-engineer more than 10 of Spatie’s packages to understand how to deliver such a high quality product. It took me over 100 hours to learn. Now you can master this from the industry’s leading experts in only 4 hours! It’s a steal.

Mohamed Said
Mohamed Said @themsaid

… Even if you have no plans to build packages, this is a HUGE learning resource. Highly recommend.

Craig Potter
Craig Potter @_CPotter

Purchased and started this yesterday… learnt something new in the first 15 minutes. Can't wait to carry on! Worth every penny…

Jesse Yeet
Jesse Yeet @jesseleite85

Can’t get much more real, @freekmurze and @spatie_be really are the whole package!

Marc Hampson
Marc Hampson @marc_hampson

Sold! Time to learn from the masters.

Andrés Santibáñez
Andrés Santibáñez @asantibanez

This one is a no brainer! Just purchased! You should too! …

Nuno Souto
Nuno Souto @nsouto

From the Package Masters themselves this will be good.

NUNO MADURO
NUNO MADURO @enunomaduro

Freek knows how to create packages better than anyone I ever know. I highly recommend this video course. 🔥

Dries Vints
Dries Vints @driesvints

Check out this new course by my buddy @freekmurze. Can definitely say an expert on package development 🤓🤙

/dev/caneco
/dev/caneco @Caneco

Not learning how to create Laravel packages with @spatie_be, it's like having a movie where Luke Skywalker went to learn the Jedi skills with the Jawa tribe, instead of Yoda 🌱

jbduler
jbduler @jbduler

ANYTHING from @freekmurze & @spatie_be is awesome anyway

Why create packages?

By moving common functionalities to packages, the codebase of your apps can become smaller and more maintainable.

Packages can have their own testsuite. When a bug is discovered, you can easily distribute the fix in your apps by merely running composer update.

There are commercial benefits as well. By open sourcing packages, you as a developer, and your company become much more visible in the community, which can lead to interesting opportunities coming your way.

Freek avatar

Meet your instructor

Chances are you already have!

Related resources