• 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

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

using random function but it's displaying duplicates

Insert multidimensional array to codeigniter cart

IlluminateDatabaseQueryException: SQLSTATE[HY000]: General error: 1 no such table - In clone project

dompdf and img tag, image wont show

Sentry + Laravel: how to log an already catched Exception?

Send same name multiple checkbox values via ajax

How to Display Data in Yajra Datatables Laravel 7?

Get latest Tweets - What API

how to fix Service provider class not found when using repository?

How can I make this nested location configuration use the correct path to call a php program?

Apply session id from request header

Make certain characters of a word from string bold

PHP each() function replacement

how to youtube api data to print in toolset metabox using a button click before save-post

About Contact Privacy policy Terms and conditions