PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, May 20, 2022

[FIXED] What are the differences between installing swiftmailer with Composer or apt?

 May 20, 2022     composer-php, php, swiftmailer, symfony     No comments   

Issue

I am using PHP Version 7.4.3 on Ubuntu 20.04.2 LTS. In its online documentation Symfony says to install swiftmailer using composer:

The recommended way to install Swiftmailer is via Composer:

$ composer require "swiftmailer/swiftmailer:^6.0"

If you are not using Symfony, does one get similar access to swiftmailer by installing it using apt?

sudo apt-get update -y && sudo apt-get install -y php-swiftmailer

Once installed with apt (it says the installed version is php-swiftmailer (5.4.2-1.1)), where is the reference documentation on the use of swiftmailer? (neither man swiftmailer nor man php-swiftmailer has a manual entry).


Solution

$ composer require "swiftmailer/swiftmailer:^6.0"

Is system agnostic and will ensure that you will always have version >= 6.x.

It is also preferable for deployments on Docker where you may be using an -alpine image which does not have apt available.

Composer will also fail the entire install if it cannot satisfy that requirment, therefore ensuring that if your app is running it has SwiftMailer.

$ sudo apt-get install -y php-swiftmailer

Will install it on a system level, so long as that system is Debian based.

It will also install it in a "global" perspective, which may be more beneficial if you're going to have multiple applications on the same server.

You likely will not know if you can use SwiftMailer until you call the class/extention and the process fails.


In short, you'll probably want to prefer the Composer method.



Answered By - Joshua
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing