How to implement $Security->loginUser equivalent?

Hi,

I am upgrading a project from PHPMaker 2022 to PHPMaker 2026.

In PHPMaker 2022, I used the following code to authenticate a user programmatically after validating the user information manually:

$Security->loginUser(
    $_SESSION['UserRow']['UserName'],
    $_SESSION['UserRow']['id'],
    '',
    $_SESSION['UserRow']['UserLevel']
);

WriteCookie("AutoLogin", "autologin");
WriteCookie("Username", Encrypt($_SESSION['UserRow']['UserName']));
WriteCookie("Password", Encrypt($_SESSION['UserRow']['Pass']));
WriteCookie('Checksum', crc32(md5(Config("RANDOM_KEY"))));

This code was used to log in the user and also enable auto-login / remember-me functionality.

I would like to know what the correct equivalent implementation is in PHPMaker 2026.

Questions:

  • What is the recommended method for programmatically logging in a user in PHPMaker 2026?
  • Is $Security->loginUser() still supported, or has the authentication flow changed?
  • How should auto-login / remember-me cookies be created in PHPMaker 2026?
  • Are WriteCookie(), Encrypt(), and the Checksum cookie still the correct approach, or should I use another built-in API/service?

Use case:

I validate the user through a custom process and then want to sign them in without redirecting them to the standard login page.

Any guidance or sample code for PHPMaker 2026 would be appreciated.

Thanks.

Since v2025, security is guarded by Symfony security. You cannot login user by manipulating session variables anymore.

To login user via Symfony security, you can get the Symfony security helper by SecurityHelper() and call the login() method, read Login Programmatically. Note that you may load the user from the user table by LoadUserByIdentifier(?string $username).

There is no WriteCookie() anymore, you may remove your code which is not required anymore. Symfony will write the required cookie.