Laravel Package Training

Laravel Package Training

  • 27 videos
  • 04 h 00 min
  • Intermediate
  • $83.00


Start this course now and publish your first package today

Having produced over 250 packages with more than 200 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.

Big v2 update

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

Course overview

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.

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

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

Source diving Spatie packages

  • laravel-tail: how to package up a simple artisan command to reuse in all your projects and share with the community
  • laravel-medialibrary: learn how we structured this big package to keep it maintainable
  • laravel-multitenancy: this source dive shows how a complicated package can remain lightweight. Lots of things to learn about the Laravel internals too.
  • laravel-short-schedule: during this source dive you'll get an intro into React PHP and learn how you can write tests for a never ending event loop.
  • laravel-collection-macros: see how we split up large classes into several smaller ones
  • laravel-responsecache: this popular package can make any Laravel application much faster. Learn how we use middleware to achieve this


No review yet.


Freek Van der Herten Profile Picture

Freek Van der Herten

I'm a PHP developer and Laravel enthusiast. Most of my time is spent at Spatie of which I'm the co-owner. Whenever my colleagues and I stumble upon a problem that we can solve in a clean way, we extract our solution so other developers can use it. Together with my colleagues I regularly release packages that have been downloaded more than 500 million times.