0
0
mirror of https://github.com/PHPMailer/PHPMailer.git synced 2024-09-20 01:52:15 +02:00

Docs cleanup

This commit is contained in:
Marcus Bointon 2016-06-30 16:12:51 +02:00
parent b8ee3d52e3
commit 49b8d7e271
3 changed files with 91 additions and 3 deletions

View File

@ -59,7 +59,7 @@ Alternatively, if you're not using composer, copy the contents of the PHPMailer
If you don't speak git or just want a tarball, click the 'zip' button on the right of the project page in GitHub.
## Upgrading from 5.2
First of all, [read the changelog](https://github.com/PHPMailer/PHPMailer/tree/master/changelog.md) which has lots of detail on the changes in 6.0. The big thing you'll need to change is how you load PHPMailer. Load PHPMailer from composer (as above) and use composer's `vendor/autoload.php` loader instead of the old `PHPMailerAutoload.php`. Because PHPMailer 6 uses a namespace, you need to import classes you're using explicitly into your own namespace, or the global namespace - all the examples show how to do this. The OAuth2 implementation has been completely redesigned, and you'll need to change your code if you were using OAuth in 5.2. A few obscure functions were removed and there are some other minor differences, but it's unlikely you will run into these. If you're concerned, take a look at the examples as they demonstrate common use cases in a PHPMailer 6.0 style.
[Read the upgrade guide](https://github.com/PHPMailer/PHPMailer/tree/master/UPGRADING.md).
## Legacy versions
PHPMailer 5.2 (which is compatible with PHP 5.0 - 7.0) is no longer being supported for feature updates, and will only be receiving security updates from now on. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable), and future versions of 5.2 will be tagged with 5.2.x version numbers, so existing composer configs should remain working. If you're using PHP 5.5 or later, we recommend you make the necessary changes to switch to the 6.0 release.

87
UPGRADING.md Normal file
View File

@ -0,0 +1,87 @@
# Upgrading from PHPMailer 5.2 to 6.0
PHPMailer 6.0 is a major update containing some backward-compatibility breaks.
If you're in doubt about how you should be using PHPMailer 6, take a look at the examples as they have all been updated to work in a PHPMailer 6.0 style.
## PHP Version
PHPMailer 6.0 requires PHP 5.5 or later, and is fully compatible with PHP 7.0. PHPMailer 5.2 supported PHP 5.0 and upwards, so if you need to run on a legacy PHP version, see the [PHPMailer 5.2-stable branch on Github](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable).
## Loading PHPMailer
The single biggest change will be in the way that you load PHPMailer. In earlier versions you'll have done this:
```php
require 'class.phpmailer.php';
require 'class.smtp.php';
```
or
```php
require 'PHPMailerAutoload.php';
```
We recommend that you load PHPMailer via composer, using its standard autoloader, which you probably won't need to load if you're using it already, but in case you're not, you will need to do this instead:
```php
require 'vendor/autoload.php';
```
If you're not using composer, you can still load the classes manually, depending on what you're using:
```php
require 'src/PHPMailer.php';
require 'src/SMTP.php';
```
## Namespace
PHPMailer 6 uses a namespace of `PHPMailer\PHPMailer`, because it's the PHPMailer project within the PHPMailer organisation. You will need to import classes you're using explicitly into your own namespace, or the global namespace - all the examples show how to do this. This means the fully-qualified name of the main PHPMailer class is `PHPMailer\PHPMailer\PHPMailer`, which is a bit of a mouthful, but there's no harm in it!
For example you might have a project like this:
```php
<?php
namespace MyProject;
use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/autoload.php';
$mail = new PHPMailer;
...
```
##OAuth2 Support
The OAuth2 implementation has been completely redesigned using the [OAuth2 packages](http://oauth2-client.thephpleague.com) from the [League of of extraordinary packages](http://thephpleague.com), and you'll need to update your code if you were using OAuth in 5.2. See [the examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) and documentation in the [PHPMailer wiki](https://github.com/PHPMailer/PHPMailer/wiki).
##Extras
* Additional classes previously bundled in the `Extras` folder (such as htmlfilter and EasyPeasyICS) have been removed - use equivalent packages from [packagist.org](https://packagist.org) instead.
##Other upgrade changes
* File structure simplified, classes live in the `src/` folder
* Most statically called functions now use the `static` keyword instead of `self`, so it's possible to override static internal functions in subclasses, for example `validateAddress()`
* Complete RFC standardisation on CRLF (`\r\n`) line breaks by default:
* `PHPMailer:$LE` removed
* `PHPMailer::CRLF` line ending constant renamed to `PHPMailer::LE`, defaults to "\r\n", used everywhere
* All uses of `PHPMailer::$LE` property converted to use `static:LE` constant for consistency and ease of overriding
* Similar changes to line break handling in SMTP and POP3 classes.
* All elements previously marked as deprecated have been removed:
* `PHPMailer->Version`
* `PHPMailer->ReturnPath`
* `PHPMailer->PluginDir`
* `PHPMailer->encodeQPphp()`
* `SMTP->CRLF`
* `SMTP->Version`
* `SMTP->SMTP_PORT`
* `POP3->CRLF`
* `POP3->Version`
* NTLM authentication has been removed - it never worked anyway!
* `PHPMailer->Workstation`
* `PHPMailer->Realm`
* `SMTP::authenticate` method signature changed
* `parseAddresses()` is now static
* `validateAddress()` is now called statically from `parseAddresses()`
* `idnSupported()` is now static and is called statically from `punyencodeAddress()`
* `PHPMailer->SingleToArray` is now protected

View File

@ -11,7 +11,7 @@ This is a major update that breaks backwards compatibility.
* Most statically called functions now use the `static` keyword instead of `self`, so it's possible to override static internal functions in subclasses, for example `validateAddress()`
* Complete RFC standardisation on CRLF (`\r\n`) line breaks by default:
* `PHPMailer:$LE` removed
* `PHPMailer::CRLF` line ending constant renamed to `PHPMailer::LE`, defaults to , used everywhere
* `PHPMailer::CRLF` line ending constant renamed to `PHPMailer::LE`, defaults to "\r\n", used everywhere
* All uses of `PHPMailer::$LE` property converted to use `static:LE` constant for consistency and ease of overriding
* Similar changes to line break handling in SMTP and POP3 classes.
* Extensive reworking of XOAUTH2, adding support for Google, Yahoo and Microsoft providers, thanks to @sherryl4george
@ -26,12 +26,13 @@ This is a major update that breaks backwards compatibility.
* `SMTP->SMTP_PORT`
* `POP3->CRLF`
* `POP3->Version`
* NTLM authentication removed - never worked anyway!
* NTLM authentication has been removed - it never worked anyway!
* `PHPMailer->Workstation`
* `PHPMailer->Realm`
* `SMTP::authenticate` method signature changed
* `parseAddresses()` is now static
* `validateAddress()` is now called statically from `parseAddresses()`
* `idnSupported()` is now static and is called statically from `punyencodeAddress()`
* `PHPMailer->SingleToArray` is now protected
* Don't try to use an auth mechanism if it's not supported by the server
* Reorder automatic AUTH mechanism selector to try most secure method first