• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

how can I set a session variable in Drupal 8 and get it in a php script?

phpsessiondrupalsession-variables


PHP Snippet 1:

$tempstore = \Drupal::service('tempstore.private')->get('your_module_name');
$tempstore->set('value', 'hi');

PHP Snippet 2:

$tempstore = \Drupal::service('tempstore.private')->get('your_module_name');
$some_data = $tempstore->get('value');

Related Snippets

Open a popup box after receiving result from ajax

How do I enable error reporting in Laravel?

Adding custom body class to the custom archive pages

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

Remove product downloads section in woocommerce email notifications

display WooCommerce “Add to cart” button with short-code [add_to_cart ] dynamically

Is there an equivalent of DynamoDB on Azure as a PHP session Handler

How to reset Laravel AuthManager/guards in between API calls in tests?

Check if my GET request has Header: Token

Creating a config file in PHP

How to get values inside <![CDATA[values]] > using php DOM?

Log a user out of a website when they put their computer to sleep

Artisan, creating tables in database

Display Brand Name Above Product Title in Woocommerce Cart, Checkout Page, Orders and Email Notification

php curl_exec() Connection refused when retrieving a remote image

About Contact Privacy policy Terms and conditions