• 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

How to extract price from given url using Xpath?

How do I remove this delivery notification from here?

PHP: How to raise number to (tiny) fractional exponent?

Form repeater send wrong data with last element in Laravel

Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

Session timeout in Yii2

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

printing all running session variable in laravel 5.1

Sagepay Error The Vendor failed to provide a RedirectionURL

Sync Records With Default Values in Pivot Tables, Call to undefined method syncWithPivotDefaults()

Remove "estimated for {country}" text after tax amount in Woocommerce checkout page

Laravel websockets AWS EC2 - Connection failed

Prestashop webservice API creating cart rules

Access denied for user 'homestead'@'localhost' (using password: YES)

PHP: Telegram Bot: Insert line break to text message

About Contact Privacy policy Terms and conditions