• 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

browsersync doesn't work with XAMPP

Laravel - Implicit route model binding with soft deleted data

PHP Deprecated issue when running artisan command

Timber: Single post pagination does not work (wp_link_pages)

Combine array with same value and add other [duplicate]

Symfony/Form add attribute based on the data

Display specific shipping method if woocommerce product has specific acf field value

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

PHP file_get_contents function

How to make dot match newline characters using regular expressions

codeigniter 4 running error first time with xampp

How can I convert from a{a{} b{}} to a[a[],b[]] using php preg_match?

Handle error for duplicate entries - PHP/MySQL

How to disable only_full_group_by option in Laravel

How can I access an array/object?

About Contact Privacy policy Terms and conditions