Download the PHP package alexwinder/laravel-confirm-new-email without Composer

On this page you can find all versions of the php package alexwinder/laravel-confirm-new-email. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-confirm-new-email

Verify Updated User E-Mail Address in Laravel 5

This is a package for Laravel which provides functionality that when a user wants to update their e-mail address they must first verify their new e-mail address for it to be successfully updated. This is particularly useful if you want to ensure that a user has control of an e-mail address when they want to make this change to their account.

This is done by sending an e-mail notification to the new users e-mail address, when they click on the link inside that e-mail then their e-mail address will be updated on the system. Upon a successful update of a users e-mail address a second e-mail notification is then sent to the new and the old e-mail address notifying the user of the change to their account.

Installation

Require Into Composer

Require this package into your composer.json.

Register Service Provider

Register the ConfirmNewEmailServiceProvider in the providers of your Laravel application under config/app.php in the providers array.

Confirm User Model

In your config/auth.php ensure that you have correctly specified your User model and table in the providers array.

E-Mail Attribute Mass-Assignment

You must ensure that your User model has the attribute which relates to e-mail address added to its $fillable array if you are protecting against mass-assignment in your Laravel project, by default all Eloquent models protect against mass-assignment. If you do not add this value to the $fillable array you will receive a mass-assignment exception. For example:

If you also wish to verify e-mail address during update then you should also add this field to your $fillable array.

Publish Vendor Files

If you wish, you can publish the configuration file with the config tag. This will create a confirm-new-email config file in your configuration path and allow you to customise this package to work with your Laravel project. If you do not publish this file then the default values set within src/config/config.php will be used however this may cause some unintended issues when trying to use this package with your project.

This package comes with a number of views for the form and the e-mail markdowns used. If you wish to customise these views for your Laravel project you can do so by publishing with the views tag. These files will be published to the views/vendor/confirm-new-email directory within the resource path of your project.

Prepare Your Laravel Project

If you choose to use this package there are a number of things of note you should be aware of which may require you making changes to your Laravel project.

  1. The views located in src/views make use of some default Laravel configuration settings. If you opt to use these views without publishing them to your project or configuring them for your use case then you should check that the following are set in your project:

    • config('app.name')
    • config('app.url')
  2. Your project should be correctly configured with e-mail server settings to allow e-mail verification notifications to be sent via e-mail to the user. To configure your particular use case for your project please consult the Laravel documentation.

  3. Your Eloquent User model should contain an email attribute which relates to that users e-mail address. If you are using the default User model/migration provided by Laravel out of the box then it is unlikely that you will need to change this. However, if you have changed the value from its default then the simplest way to resolve this is to define an accessor in your User model for the email attribute:

Usage

Routes

In the src/routes.php file, a number of routes have been defined which are used to display the update form, and to process the e-mail address update.

If you choose to use the default views contained within this package you can link to the update form in your views by making use of the following:

If you wish you can opt not to use route(config('confirm-new-email.route.edit.name')) and you can create your own form. However, in your form to make use of this package you must submit with a POST request to route(config('confirm-new-email.route.update-request.name')) or route(config('confirm-new-email.route.update-request.uri')) and you must send a new_email value to this route. For example:

Configuration Settings

Whilst every effort has been made to provide detailed information within the configuration file, further information about the configuration values can be found below.

E-Mail Verification

email-verify is a boolean value which when set to true will also update the users verified at datetime.

Please note that this value will be updated to the current datetime stamp as is the same method used within Laravel. Therefore if you have changed the default way Laravel verifies users then you should leave this value set to false.

If you set this value to true you must do the following:

Redirect

redirect is an array of values used to specify named routes used to redirect the user at points in the process.

Please note that these are named routes and so the named route must exist within your Laravel project.

Route URI/Names

route is an array of values used to define the route names and URI's inside the src/routes.php file. If you wish to customise the route name/URI from this package for your Laravel project then you should edit these configuration values.

If you are working from a default Laravel project then you likely do not need to change these values, unless of course you do not like the naming convention. If you have conflicting route names/URI's already in your Laravel project then these default values should be changed.

All of the name values for the routes should be unique to each other.

It should be noted that if you change from the default values for the config('confirm-new-email.route.edit.name') then you may also need to update config('confirm-new-email.redirect.update-confirm') to match your new route name as listed in the Redirect section.

Update Expiry

update-expiry is an array of values which is used to set an expiry limit on the e-mail address confirmation. When these values are correctly set the user will have a set number of minutes to confirm their new e-mail address.

User Settings

user is an array of values which relates to the User model in your Laravel project.

E-Mail Notifications

When a POST request with a new_email value is sent to config('confirm-new-email.route.update-request.name') the following happens:

This URL will be a signed URL to config('confirm-new-email.route.update-confirm.name'). This is a GET request which does the following:

For both routes the Laravel auth middleware is in place - as the user must be fully authenticated to complete the update to their e-mail address.

The e-mail notifications sent make use of markdown. If you wish to edit the content of these e-mails you should publish the views - this will be published to views/vendor/confirm-new-email directory within the resource path of your project where you can then edit them to fit your specific needs.

TODO

Changelog

A changelog of this project can be found in CHANGELOG.md.

License

This project is licensed under the MIT License.


All versions of laravel-confirm-new-email with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.3
illuminate/bus Version ~5.8
illuminate/contracts Version ~5.8
illuminate/http Version ~5.8
illuminate/notifications Version ~5.8
illuminate/support Version ~5.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alexwinder/laravel-confirm-new-email contains the following files

Loading the files please wait ....