Download the PHP package pantheon-systems/wp-native-php-sessions without Composer

On this page you can find all versions of the php package pantheon-systems/wp-native-php-sessions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-native-php-sessions

WordPress Native PHP Sessions

Contributors: getpantheon, outlandish josh, mpvanwinkle77, danielbachhuber, andrew.taylor, jazzs3quence, stovak, jspellman, rwagner00
Tags: comments, sessions
Requires at least: 4.7
Tested up to: 6.3
Stable tag: 1.4.3
Requires PHP: 5.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Use native PHP sessions and stay horizontally scalable. Better living through superior technology.

Description

Actively Maintained CircleCI

WordPress core does not use PHP sessions, but sometimes they are required by your use-case, a plugin or theme.

This plugin implements PHP's native session handlers, backed by the WordPress database. This allows plugins, themes, and custom code to safely use PHP $_SESSIONs in a distributed environment where PHP's default tempfile storage just won't work.

Note that primary development is on GitHub if you would like to contribute:

https://github.com/pantheon-systems/wp-native-php-sessions

Installation

  1. Upload to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress

That's it!

Configuration

By default the session lifetime is set to 0, which is until the browser is closed.

To override this use the pantheon_session_expiration filter before the WordPress Native PHP Sessions plugin is loaded. For example a small Must-use plugin (a.k.a. mu-plugin) could contain:

<?php
function my_session_expiration_override() {
    return 60*60*4; // 4 hours
}
add_filter( 'pantheon_session_expiration', 'my_session_expiration_override' );

CLI Commands

wp pantheon session add-index

Added in 1.4.0. This command should be run if your installation of the plugin occurred before the addition of the primary ID key to the session table in version 1.2.2. You will be automatically notified when you visit any admin page if this is the case. If there's no message, your version is good to go. Note that this command is non-destructive, a new table will be created and the existing one preserved in a backup state until you have verified that the upgrade is functioning as expected.

wp pantheon session primary-key-finalize

Added in 1.4.0. If you have run the add-index command and have verified that the new table is functioning correctly, running the primary-key-finalize command will perform a database cleanup and remove the backup table.

wp pantheon session primary-key-revert

Added in 1.4.0. If you have run the add-index command and something unexpected has occurred, just run the primary-key-revert command and the backup table will immediately be returned to being the active table.

WordPress Multisite

As of 1.4.2 the add-index, primary-key-add and primary-key-revert commands are fully multisite compatible.

Contributing

See CONTRIBUTING.md for information on contributing.

Security Policy

Reporting Security Bugs

Please report security bugs found in the Native PHP Sessions plugin's source code through the Patchstack Vulnerability Disclosure Program. The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.

Frequently Asked Questions

Why not use another session plugin?

This implements the built-in PHP session handling functions, rather than introducing anything custom. That way you can use built-in language functions like the $_SESSION superglobal and session_start() in your code. Everything else will "just work".

Why store them in the database?

PHP's fallback default functionality is to allow sessions to be stored in a temporary file. This is what most code that invokes sessions uses by default, and in simple use-cases it works, which is why so many plugins do it.

However, if you intend to scale your application, local tempfiles are a dangerous choice. They are not shared between different instances of the application, producing erratic behavior that can be impossible to debug. By storing them in the database the state of the sessions is shared across all application instances.

Troubleshooting

If you see an error like "Fatal error: session_start(): Failed to initialize storage module:" or "Warning: ini_set(): A session is active.", then you likely have a plugin that is starting a session before WP Native PHP Sessions is loading.

To fix, create a new file at wp-content/mu-plugins/000-loader.php and include the following:

<?php
require_once WP_PLUGIN_DIR . '/wp-native-php-sessions/pantheon-sessions.php';

This mu-plugin will load WP Native PHP Sessions before all other plugins, while letting you still use the WordPress plugin updater to keep the plugin up-to-date.

Upgrade Notice

1.4.0

Adds a WP-CLI command to add an index to the sessions table if one does not exist already. If you installed this plugin before version 1.2.2, you likely need to run this command. However, regardless of version at installation a notice will appear in your admin dashboard if your database table is missing the index. If no notice appears, no action is necessary.

Changelog

1.4.3 (November 13, 2023)

1.4.2 (November 8, 2023)

1.4.1 (October 23, 2023)

1.4.0 (October 17, 2023)

1.3.6 (June 1, 2023)

1.3.5 (April 7, 2023)

1.3.4 (February 7, 2023)

1.3.3 (January 25, 2023)

1.3.2 (January 25, 2023)

1.3.1 (December 5, 2022)

1.3.0 (November 28th, 2022)

1.2.5 (October 28th, 2022)

1.2.4 (September 14th, 2021)

1.2.3 (April 9th, 2021)

1.2.2 (March 29th, 2021)

1.2.1 (September 17th, 2020)

1.2.0 (May 18th, 2020)

1.1.0 (April 23rd, 2020)

1.0.0 (March 2nd, 2020)

0.9.0 (October 14th, 2019)

0.8.1 (August 19th, 2019)

0.8.0 (August 13th, 2019)

0.7.0 (April 3rd, 2019)

0.6.9 (May 15th, 2018)

0.6.8 (May 4th, 2018)

0.6.7 (April 26th, 2018)

0.6.6 (March 8th, 2018)

0.6.5 (February 6th, 2018)

0.6.4 (October 10th, 2017)

0.6.3 (September 29th, 2017)

0.6.2 (June 6th, 2017)

0.6.1 (May 25th, 2017)

0.6.0 (November 23rd, 2016)

0.5

0.4

0.3

0.1


All versions of wp-native-php-sessions with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pantheon-systems/wp-native-php-sessions contains the following files

Loading the files please wait ....