• 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

onKeyUp event calculation not working on the following rows from php generated forms except the first one

How to get the survey List from surveygizmo API in the Postman?(Trial Version)

PHP rotate matrix counter-clockwise

How to prevent phpmailer sending embedded image as an attachment on Gmail?

XDebug not working in VScode for php debugging

Assets not referencing to public folder (Laravel)

merge all files in directory to one text file

WordPress ACFNotice: get_field() - We've detected one or more calls to retrieve ACF field values before ACF has been initialized

Adding one microsecond to Datetime object in PHP

How to extract price from given url using Xpath?

Laravel insert dynamic input values with radio button

Updating and Synchronizing Woocommerce Subscriptions to Custom Date

Debugging Stripe Webhook Event

Detect if PHP session exists

php echo xml documents with header

About Contact Privacy policy Terms and conditions