The Cloudways blog has a new tutorial posted showing you how to set up a system for user authentication via email in a Yii2-based application. The concepts would be the same in just about any other framework, it's just the code to implement it would be slightly different.
User authentication is an essential component of every web app. Whether it is a simple to-do list or a complex corporate portal, user authentication remains a common factor across all types of PHP applications.[...] In this tutorial, I will show you how to develop a user authentication component in Yii2 that features a SMTP email verification. If you are new to Yii2, you must first read previous tutorials to get an introduction to Yii2. Next read about form handling in Yii 2 and database management in Yii 2.
The tutorial makes use of this extension for the traditional user handling as a more flexible option than the built-in framework features. They then walk you through the process of creating the new Yii2 project and getting the component installed. It also helps you:
- run the migrations to create the required tables
- set up the SMTP mailer
- update the navigation with the links for logged in/logged out users
- configuring the email settings
The end result is a signup form that, when submitted will send an email to the user's email address to verify it and allow the user to continue the registration process.