Movatterモバイル変換


[0]ホーム

URL:


Chapters

29 Chapters| 3:14:24|
  • 01
    Flex, Versioning & extra.symfony.require
    8:32
  • 02
    Managing Flex, extra.symfony.require & Version Constraints
    5:02
  • 03
    Upgrading to Symfony 4.4
    5:46
  • 04
    Selectively Committing Recipe Updates
    4:35
  • 05
    Upgrading Recipes: New Commands!
    6:36
  • 06
    Recipe Upgrade: symfony/console & bootstrap.php
    8:24
  • 07
    Upgrading the FrameworkBundle Recipe (Part 1)
    6:17
  • 08
    FrameworkBundle Recipe Part 2: The Kernel Class
    8:37
  • 09
    Updating the TwigBundle Recipe
    7:35
  • 10
    Updating the Mailer Recipe(s)
    4:39
  • 11
    phpunit-bridge & routing Recipes
    6:17
  • 12
    Updating security, translation & validator Recipes
    5:08
  • 13
    Updating the webpack-encore-bundle Recipe
    6:05
  • 14
    Fixing the First Deprecations
    6:14
  • 15
    Upgrading KnpPaginatorBundle & PHP Platform Version
    7:18
  • 16
    Upgrading/Migrating from StofDoctrineExtensions
    4:50
  • 17
    Upgrading to DoctrineBundle 2.0
    6:50
  • 18
    DoctrineBundle Updates & Recipe Upgrade
    11:22
  • 19
    Fixing our Deprecations: Form, Controller & Mailer
    7:34
  • 20
    Hunting the Final Deprecations
    5:06
  • 21
    Upgrading to Symfony 5.0
    9:10
  • 22
    Secrets Management Setup
    9:35
  • 23
    Production Secrets
    7:10
  • 24
    Overriding Secrets Locally (Local Vault)
    4:04
  • 25
    Prod Vault Optimization & Vault for Tests
    4:53
  • 26
    Validation Auto-Mapping
    8:49
  • 27
    Migrate Password Hashing
    9:46
  • 28
    PHP 7.4 preload
    3:00
  • 29
    Is your Container Running? Catch It! lint:container
    5:10
Login to bookmark this video
Login to bookmark this video
Buy Access to Course
10.

Updating the Mailer Recipe(s)

Share this awesome video!

|

Scroll down to the script below, click on any sentence (including terminal blocks) to jump to that spot in the video!

Show me the script!
Subscribe to jump to this part in the video!

Keep on Learning!

If you liked what you've learned so far, dive in! Subscribe to get
access to this tutorial plus video, code and script downloads.

Edit on Github

With a Subscription, click any sentence in the script to jump to that part of the video!

LoginSubscribe

The next recipe on our list issymfony/mailer...which is anespecially interesting one because, until Symfony 4.4,symfony/mailer was marked as "experimental".That means that thereare some backwards-compatibility breaksbetween Symfony 4.3 and 4.4.The recipe updatemight help us find out about a few of these.

Run:

composer recipes symfony/mailer

Then copy therecipes:install command and run it:

composer recipes:install symfony/mailer --force -v

According to the output, this only touchedone file.Let's see for sure.Run:

git status

Yep!Only.env was changed.Run:

git add -p

Hmm.It looks like itremoved two comment lines, which mention that theMAILER_DSNfor thenull transport looks different in Symfony 4.4.And then it added an example of using thesmtp transport.The top line is my custom code.

I don'treally want these changes.I mean, Ido still want to define aMAILER_DSN environment variableand Ido still want to use thenull transport.Except... the removed notedid just remind me about a syntax changein thenull transport for Symfony 4.4.

Hit "n" tonot add this change...for now. Then hit "y" for thesymfony.lock update.

The Updated Null Mailer Transport Syntax

Let's see how things look:

git status

Undo the changes:

git checkout .env

Open.env in our editor...and find the "mailer" section:

Copy Code
Show All Lines
62 lines|.env
Show Lines
// ... lines 1 - 37
###> symfony/mailer ###
MAILER_DSN=smtp://null
# in Symfony 4.4 and higher, the syntax is
# MAILER_DSN=null://default
###< symfony/mailer ###
Show Lines
// ... lines 43 - 62

Even though we didn't accept the new recipe changes, wedo need to update our syntax.Copy the example and paste.Actually, thedefault part can be anything - you'll sometimes seenull:

Copy Code
Show All Lines
61 lines|.env
Show Lines
// ... lines 1 - 37
###> symfony/mailer ###
MAILER_DSN=null://null
# in Symfony 4.4 and higher, the syntax is
# MAILER_DSN=null://default
###< symfony/mailer ###
Show Lines
// ... lines 43 - 61

Andnow if you wanted to delete the extra comments about Symfony 4.4, you totally could...and probably should.

So... we basically didn't useanything from the updated recipe,but itdid remind us of a change we needed to make.

Checking the CHANGELOG

And becausesymfony/mailer may haveother backwards-compatibility breaks,it's not a bad idea to check its CHANGELOG.I'll go tohttps://github.com/symfony/mailer...and click to see it.Yep! You can see info about thenull change and a few others.We'll see one of these later.

Back at your terminal, run:

composer recipes

again.There'sone other recipe that's relevant to symfony/mailer.It'ssymfony/sendgrid-mailer: a package that helps us send emails through SendGrid.Let's skip straight to updating this:

composer recipes:install symfony/sendgrid-mailer --force -v

And then step through the changes with:

git add -p

The first change is inside.env.Oh! Ha! That's the changewe made, I forgot to add it.Hit "y" to add it now.

Theother change isalso in.env: it changed theMAILER_DSN examplefrom something starting withsmtp:// tosendgrid://.Similar to thenull transport situation,symfony/mailer 4.4also changed the syntax for a fewother transports.

I'm going to say "y" to accept this change: both the old and new code were just examples anyway.

But, there is oneother spot you need to check:we need to see if we're using the old format in the.env.local file.Go open that up.In this project, nope!I'm not overriding that.If wedid havesmtp://sendgrid inany env files, or configured as areal environment variable,maybe on production, that would need to be updated.

For the last change - tosymfony.lock - hit "y" to add it.Run:

git status

to make sure we're not missing anything.Looks good!Commit!

git commit -m "updating symfony/mailer recipe packages"

Done!We're down to thelast few recipe updates.Let'scrush them.

Comments

Sort By
Login orRegister to join the conversation

Delete comment?

Share this comment

astronaut with balloons in space

"Houston: no signs of life"
Start the conversation!

What PHP libraries does this tutorial use?

// composer.json{    "require": {        "php": "^7.3.0",        "ext-iconv": "*",        "antishov/doctrine-extensions-bundle": "^1.4", // v1.4.2        "aws/aws-sdk-php": "^3.87", // 3.110.11        "composer/package-versions-deprecated": "^1.11", // 1.11.99        "doctrine/annotations": "^1.0", // 1.10.1        "doctrine/doctrine-bundle": "^2.0", // 2.0.6        "doctrine/doctrine-migrations-bundle": "^1.3|^2.0", // 2.1.2        "doctrine/orm": "^2.5.11", // v2.7.2        "doctrine/persistence": "^1.3.7", // 1.3.8        "easycorp/easy-log-handler": "^1.0", // v1.0.9        "http-interop/http-factory-guzzle": "^1.0", // 1.0.0        "knplabs/knp-markdown-bundle": "^1.7", // 1.8.1        "knplabs/knp-paginator-bundle": "^5.0", // v5.0.0        "knplabs/knp-snappy-bundle": "^1.6", // v1.7.0        "knplabs/knp-time-bundle": "^1.8", // v1.11.0        "league/flysystem-aws-s3-v3": "^1.0", // 1.0.23        "league/flysystem-cached-adapter": "^1.0", // 1.0.9        "league/html-to-markdown": "^4.8", // 4.8.2        "liip/imagine-bundle": "^2.1", // 2.3.0        "nexylan/slack-bundle": "^2.1", // v2.2.1        "oneup/flysystem-bundle": "^3.0", // 3.3.0        "php-http/guzzle6-adapter": "^2.0", // v2.0.1        "phpdocumentor/reflection-docblock": "^3.0|^4.0", // 4.3.4        "sensio/framework-extra-bundle": "^5.1", // v5.5.3        "symfony/asset": "5.0.*", // v5.0.2        "symfony/console": "5.0.*", // v5.0.2        "symfony/dotenv": "5.0.*", // v5.0.2        "symfony/flex": "^1.0", // v1.21.6        "symfony/form": "5.0.*", // v5.0.2        "symfony/framework-bundle": "5.0.*", // v5.0.2        "symfony/mailer": "5.0.*", // v5.0.2        "symfony/messenger": "5.0.*", // v5.0.2        "symfony/monolog-bundle": "^3.5", // v3.5.0        "symfony/property-access": "4.4.*|5.0.*", // v5.0.2        "symfony/property-info": "4.4.*|5.0.*", // v5.0.2        "symfony/security-bundle": "5.0.*", // v5.0.2        "symfony/sendgrid-mailer": "5.0.*", // v5.0.2        "symfony/serializer": "4.4.*|5.0.*", // v5.0.2        "symfony/twig-bundle": "5.0.*", // v5.0.2        "symfony/validator": "5.0.*", // v5.0.2        "symfony/webpack-encore-bundle": "^1.4", // v1.7.2        "symfony/yaml": "5.0.*", // v5.0.2        "twig/cssinliner-extra": "^2.12", // v2.12.0        "twig/extensions": "^1.5", // v1.5.4        "twig/extra-bundle": "^2.12|^3.0", // v3.0.1        "twig/inky-extra": "^2.12", // v2.12.0        "twig/twig": "^2.12|^3.0" // v2.14.4    },    "require-dev": {        "doctrine/doctrine-fixtures-bundle": "^3.0", // 3.3.0        "fzaninotto/faker": "^1.7", // v1.8.0        "symfony/browser-kit": "5.0.*", // v5.0.2        "symfony/debug-bundle": "5.0.*", // v5.0.2        "symfony/maker-bundle": "^1.0", // v1.14.3        "symfony/phpunit-bridge": "5.0.*", // v5.0.2        "symfony/stopwatch": "4.4.*|5.0.*", // v5.0.2        "symfony/var-dumper": "5.0.*", // v5.0.2        "symfony/web-profiler-bundle": "4.4.*|5.0.*" // v5.0.2    }}

[8]ページ先頭

©2009-2025 Movatter.jp