Customization

Customizing your API to your liking is easy with BeRest API framework.

Modifying configurations

BeRest framework supports customization of both emails and texts. To do so, you will need to modify some configurations in DevConfigs.php.

$app['email.directory'] = ROOTDIR . '/vendors/composer/BeRest/API/src/BeRest/API/Emails';
[...]
$app['translator.directory'] = ROOTDIR . '/vendors/composer/BeRest/API/src/BeRest/API/Locales';
		

You will need to change the path to point to your project's folders instead of the folders provided by the framework.

Email Customization

To change the look and feel or the content of the emails provided by the framework, you need to create a new folder and, depending on the features you are using, add the following files.

confirm.html
confirm.txt
forgot_password.html
forgot_password.txt
invite.html
invite.txt
reset_password.html
reset_password.txt
welcome.html
welcome.txt
		

All of these emails have access to app_name as a variable for the user name.

In the case of confirm.*, you can use links_confirm and token to link to your application confirmation script.

In the case of forgot_password.*, you can use links_forgot_password and token to link to your application reset password script.

In the case of invite.*, you can user links_invite and token to link to your application accept invite script.

In all cases, you can use links_app to link to your application entry point.

Finally, we recommend using string token instead of text directly in the templates to ensure multi-lingual keeps working such as 'common_hello' | trans.

Text Customization

To change the text used in the emails provided by the framework, you need to create a new folder and add a file en_CA.yml in it.

The content of that file provided with the framework is the following.

common_hello: Hello
common_app_link: Access

confirm_subject: Confirm your account on
confirm_intro: Thank you for signing up on
confirm_intro2: We need you to confirm your email address.
confirm_link: Confirm account

welcome_subject: Welcome to
welcome_intro: Thank you for signing up on
welcome_intro2: Your account is now ready to use.

forgot_password_subject: Forgot your password?
forgot_password_intro: You recently requested to reset your password on
forgot_password_intro2: If you have not done this action, simply ignore this email.
forgot_password_link: Reset password

reset_password_subject: Your password was reset
reset_password_intro: Your password has been reset on
reset_password_intro2: If you have not done this action, please contact our support team.

invite_subject: Invitation to join
invite_intro: You just received an invitation to join
invite_link: Accept invite
		

If you choose to customize the email templates, you can add new strings as well.