Creating a Reusable (& Amazing) Symfony Bundle

2:21:06

What you'll be learning

This tutorial is built using Symfony 4, but most of the concepts apply fine to Symfony 5!
// composer.json
{
    "require": {
        "php": "^7.1.3",
        "ext-iconv": "*",
        "doctrine/annotations": "^1.8", // v1.8.0
        "knplabs/knp-markdown-bundle": "^1.7", // 1.7.0
        "nexylan/slack-bundle": "^2.0", // v2.0.0
        "php-http/guzzle6-adapter": "^1.1", // v1.1.1
        "sensio/framework-extra-bundle": "^5.1", // v5.1.6
        "symfony/asset": "^4.0", // v4.0.6
        "symfony/console": "^4.0", // v4.0.6
        "symfony/flex": "^1.0", // v1.2.7
        "symfony/framework-bundle": "^4.0", // v4.0.6
        "symfony/lts": "^4@dev", // dev-master
        "symfony/twig-bundle": "^4.0", // v4.0.6
        "symfony/web-server-bundle": "^4.0", // v4.0.6
        "symfony/yaml": "^4.0", // v4.0.6
        "weaverryan_test/lorem-ipsum-bundle": "^1.0" // v1.0.0
    },
    "require-dev": {
        "easycorp/easy-log-handler": "^1.0.2", // v1.0.4
        "sensiolabs/security-checker": "^4.1", // v4.1.8
        "symfony/debug-bundle": "^3.3|^4.0", // v4.0.6
        "symfony/dotenv": "^4.0", // v4.0.6
        "symfony/maker-bundle": "^1.0", // v1.1.1
        "symfony/monolog-bundle": "^3.0", // v3.2.0
        "symfony/phpunit-bridge": "^3.3|^4.0", // v4.3.3
        "symfony/profiler-pack": "^1.0", // v1.0.3
        "symfony/var-dumper": "^3.3|^4.0" // v4.0.6
    }
}

Want to share some code between projects, or maybe with the whole world? Let's do it! By creating a Symfony bundle! In this tutorial, we'll learn about bundles, their super-powers, how to add services & routes and the best-practices to create the best bundle possible:

  • Anatomy of a Bundle
  • Bundles vs Libraries
  • Building a bundle inside your app
  • DependencyExtensions to add Services
  • Complex Service configuration: Definitions & compiler passes
  • Allowing config via a Configuration class
  • Private services
  • Routing & other Configuration
  • Creating a Recipe
  • Registering your bundle with Packagist
  • Handling Releases
  • README!

Not only will you be able to create your own bundle, but we'll learn a lot along the way about how all bundles in the Symfony world work!


Your Guides

Ryan Weaver

Buy Access

Questions? Conversation?