public static method

Manually authenticate a user with the given set of data. Rather than checking a user's credentials, this method allows you to manually specify a user for whom you'd like to initialize an authenticated session.

By default, before writing the data to the session, the set() method of the named configuration's adapter receives the data to be written, and has an opportunity to modify or reject it.


  • string $name

    The name of the adapter configuration to.

  • array $data

    The user data to be written to the session.

  • array $options

    Any additional session-writing options. These may override any options set by the default session configuration for $name.



Returns the array of data written to the session, or false if the adapter rejects the data.


This method can be filtered.


	public static function set($name, $data, array $options = []) {
		$params = compact('name', 'data', 'options');

		return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
			$config = static::_config($name);
			$session = $config['session'];

			if ($data = static::adapter($name)->set($data, $options)) {
				$session['class']::write($session['key'], $data, $options + $session['options']);
				return $data;
			return false;