Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Session Laravel Package

joomla/session

Framework-agnostic PHP 8.1+ session management from the Joomla Framework. Provides interfaces and utilities to start and manage sessions, store and retrieve session data, and integrate session handling cleanly within your application.

View on GitHub
Deep Wiki
Context7

Joomla\Session\SessionInterface

The SessionInterface defines an class which manages session data in a web application. This interface is an extension of PHP's IteratorAggregate interface and implementations must comply with the iterator's requirements as well.

Functionally, this interface is a wrapper around Joomla\Session\StorageInterface and many of the methods are inherently similar, please see the documentation for the StorageInterface for more details about the noted methods.

Storage Wrapping Methods

  • getName()
  • setName()
  • getId()
  • getId()
  • isActive()
  • isStarted()
  • get()
  • set()
  • has()
  • remove()
  • clear()
  • all()
  • close()
  • gc()
  • abort()

Get the session lifetime

The getExpire() method is used to get the session lifetime in seconds.

/**
 * [@return](https://github.com/return)  integer  The session expiration time in seconds
 */
public function getExpire();

Check if session is new

The is() method is used to determine if a session is new (generally, this is true if the session was created in the current request).

/**
 * [@return](https://github.com/return)  boolean
 */
public function isNew();

Get the session token

The getToken() method is used to fetch the current session token. This token is generally used in conjunction with CSRF related checks.

/**
 * [@param](https://github.com/param)   boolean  $forceNew  If true, forces a new token to be created
 *
 * [@return](https://github.com/return)  string
 *
 * [@since](https://github.com/since)   __DEPLOY_VERSION__
 */
public function getToken($forceNew = false);

Check if the session has a token

The hasToken() method is used to determine if the current session token matches the specified token.

/**
 * Check if the session has the given token.
 *
 * [@param](https://github.com/param)   string   $token        Hashed token to be verified
 * [@param](https://github.com/param)   boolean  $forceExpire  If true, expires the session
 *
 * [@return](https://github.com/return)  boolean
 *
 * [@since](https://github.com/since)   __DEPLOY_VERSION__
 */
public function hasToken($token, $forceExpire = true);

Start the session

The start() method is used to start the session. Generally, this includes calling the StorageInterface::start() method, validating the current session against potential attacks, configuring any session related internal behaviors, and optionally dispatching events to subscribers.

/**
 * [@return](https://github.com/return)  void
 */
public function start();

Destroy the session

The start() method is used to start the session. Generally, this includes calling the StorageInterface::start() method, validating the current session against potential attacks, configuring any session related internal behaviors, and optionally dispatching events to subscribers.

/**
 * [@return](https://github.com/return)  boolean
 */
public function destroy();

Restart the session

The restart() method is used to restart an expired or locked session. Generally, this includes calling the StorageInterface::start() method, validating the current session against potential attacks, configuring any session related internal behaviors, and optionally dispatching events to subscribers.

/**
 * [@return](https://github.com/return)  void
 */
public function restart();

Fork the session

The fork() method is used to generate a new session with the existing data.

An example use of this method is to migrate the session data to a new session (with a new ID) after a user authenticates with your application.

/**
 * [@return](https://github.com/return)  boolean
 */
public function fork();
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport