PHPackages                             magepow/customersession - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. magepow/customersession

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

magepow/customersession
=======================

Help you able to get customer session data when varnish cache is enable.

1.0.0(4y ago)091OSL-3.0PHP

Since Jul 21Pushed 3y ago1 watchersCompare

[ Source](https://github.com/magepow/magento-2-customer-session)[ Packagist](https://packagist.org/packages/magepow/customersession)[ RSS](/packages/magepow-customersession/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

[![](https://github.com/magepow/themeforest/raw/master/shopify/shopify_affiliate.jpg)](https://shopify.pxf.io/VyL446)

Magento 2 CustomerSession Extension Free
----------------------------------------

[](#magento-2-customersession-extension-free)

In Magento 2, we can't get customer session from \\Magento\\Customer\\Model\\Session when varnish cache is enable so we use \\Magento\\Framework\\App\\Http\\Context instead. But by default, \\Magento\\Framework\\App\\Http\\Context only gives the value of customer\_group and customer\_logged\_in. **CustomerSession extension free by Magepow** allows you to get more than just customer\_group and customer\_logged\_in is customer id, name, email and other customer attributes if set.

How to install Magento 2 CustomerSession extension Free
-------------------------------------------------------

[](#how-to-install-magento-2-customersession-extension-free)

### ✓ Install Magepow CustomerSession via composer (recommend)

[](#-install-magepow-customersession-via-composer-recommend)

Run the following command in Magento 2 root folder:

```
composer require magepow/customersession
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f

```

Magepow CustomerSession user guide
----------------------------------

[](#magepow-customersession-user-guide)

### Example:

[](#example)

#### 1. Get customer\_logged\_in

[](#1-get-customer_logged_in)

```
$ObjectManager= \Magento\Framework\App\ObjectManager::getInstance();
$context = $ObjectManager->get('Magento\Framework\App\Http\Context');
$isLoggedIn = $context->getValue(\Magento\Customer\Model\Context::CONTEXT_AUTH);

```

#### 1. Get customer\_group

[](#1-get-customer_group)

```
$ObjectManager= \Magento\Framework\App\ObjectManager::getInstance();
$context = $ObjectManager->get('Magento\Framework\App\Http\Context');
$isLoggedIn = $context->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP);

```

#### 1. Get customer id

[](#1-get-customer-id)

```
$ObjectManager= \Magento\Framework\App\ObjectManager::getInstance();
$context = $ObjectManager->get('Magento\Framework\App\Http\Context');
$isLoggedIn = $context->getValue('customer_id');

```

#### 1. Get customer name

[](#1-get-customer-name)

```
$ObjectManager= \Magento\Framework\App\ObjectManager::getInstance();
$context = $ObjectManager->get('Magento\Framework\App\Http\Context');
$isLoggedIn = $context->getValue('customer_name');

```

#### 1. Get customer email

[](#1-get-customer-email)

```
$ObjectManager= \Magento\Framework\App\ObjectManager::getInstance();
$context = $ObjectManager->get('Magento\Framework\App\Http\Context');
$isLoggedIn = $context->getValue('customer_email');

```

To get more customer attributes you have to edit method **aroundDispatch** in \\Magepow\\CustomerSession\\Plugin\\CustomerSessionContext.php

Donation
--------

[](#donation)

If this project help you reduce time to develop, you can give me a cup of coffee :)

[![paypal](https://camo.githubusercontent.com/e1ff554a09e8e92bef25abc553ff05b88f45afd695877cf12f3a46558ef65b2e/68747470733a2f2f7777772e70617970616c6f626a656374732e636f6d2f656e5f55532f692f62746e2f62746e5f646f6e61746543435f4c472e676966)](https://www.paypal.com/paypalme/alopay)

**[Our Magento 2 Extensions](https://magepow.com/magento-2-extensions.html)**

- [Magento 2 Recent Sales Notification](https://magepow.com/magento-2-recent-order-notification.html)
- [Magento 2 Categories Extension](https://magepow.com/magento-categories-extension.html)
- [Magento 2 Sticky Cart](https://magepow.com/magento-sticky-cart.html)
- [Magento 2 Ajax Contact](https://magepow.com/magento-ajax-contact-form.html)
- [Magento 2 Lazy Load](https://magepow.com/magento-lazy-load.html)
- [Magento 2 Mutil Translate](https://magepow.com/magento-multi-translate.html)
- [Magento 2 Instagram Integration](https://magepow.com/magento-2-instagram.html)
- [Magento 2 Lookbook Pin Products](https://magepow.com/lookbook-pin-products.html)
- [Magento 2 Product Slider](https://magepow.com/magento-product-slider.html)
- [Magento 2 Product Banner](https://magepow.com/magento-2-banner-slider.html)

**[Our Magento 2 services](https://magepow.com/magento-services.html)**

- [PSD to Magento 2 Theme Conversion](https://alothemes.com/psd-to-magento-theme-conversion.html)
- [Magento 2 Speed Optimization Service](https://magepow.com/magento-speed-optimization-service.html)
- [Magento 2 Security Patch Installation](https://magepow.com/magento-security-patch-installation.html)
- [Magento 2 Website Maintenance Service](https://magepow.com/website-maintenance-service.html)
- [Magento 2 Professional Installation Service](https://magepow.com/professional-installation-service.html)
- [Magento 2 Upgrade Service](https://magepow.com/magento-upgrade-service.html)
- [Magento 2 Customization Service](https://magepow.com/customization-service.html)
- [Hire Magento 2 Developer](https://magepow.com/hire-magento-developer.html)

**[Our Magento 2 Themes](https://alothemes.com/)**

- [Expert Multipurpose Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/expert-premium-responsive-magento-2-and-1-support-rtl-magento-2-/21667789)
- [Gecko Premium Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/gecko-responsive-magento-2-theme-rtl-supported/24677410)
- [Milano Fashion Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/milano-fashion-responsive-magento-1-2-theme/12141971)
- [Electro 2 Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/electro2-premium-responsive-magento-2-rtl-supported/26875864)
- [Electro Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/electro-responsive-magento-1-2-theme/17042067)
- [Pizzaro Food responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/pizzaro-food-responsive-magento-1-2-theme/19438157)
- [Biolife organic responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/biolife-organic-food-magento-2-theme-rtl-supported/25712510)
- [Market responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/market-responsive-magento-2-theme/22997928)
- [Kuteshop responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/kuteshop-multipurpose-responsive-magento-1-2-theme/12985435)
- [Bencher - Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/bencher-responsive-magento-1-2-theme/15787772)
- [Supermarket Responsive Magento 2 Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/supermarket-responsive-magento-1-2-theme/18447995)

**[Our Shopify Themes](https://themeforest.net/user/alotheme)**

- [Dukamarket - Multipurpose Shopify Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/dukamarket-multipurpose-shopify-theme/36158349)
- [Ohey - Multipurpose Shopify Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/ohey-multipurpose-shopify-theme/34624195)
- [Flexon - Multipurpose Shopify Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/flexon-multipurpose-shopify-theme/33461048)

**[Our Shopify App](https://apps.shopify.com/partners/maggicart)**

- [Magepow Infinite Scroll](https://apps.shopify.com/magepow-infinite-scroll)
- [Magepow Promotionbar](https://apps.shopify.com/magepow-promotionbar)
- [Magepow Size Chart](https://apps.shopify.com/magepow-size-chart)

**[Our WordPress Theme](https://themeforest.net/user/alotheme/portfolio)**

- [SadesMarket - Multipurpose WordPress Theme](https://1.envato.market/c/1314680/275988/4415?u=https://themeforest.net/item/sadesmarket-multipurpose-wordpress-theme/35369933)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1762d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49830061?v=4)[https://magepow.com](/maintainers/magepow)[@magepow](https://github.com/magepow)

---

Top Contributors

[![zetman0369](https://avatars.githubusercontent.com/u/64524705?v=4)](https://github.com/zetman0369 "zetman0369 (4 commits)")[![davidduong90](https://avatars.githubusercontent.com/u/39608917?v=4)](https://github.com/davidduong90 "davidduong90 (1 commits)")[![magiccart](https://avatars.githubusercontent.com/u/10281371?v=4)](https://github.com/magiccart "magiccart (1 commits)")[![Zoe-997](https://avatars.githubusercontent.com/u/57448131?v=4)](https://github.com/Zoe-997 "Zoe-997 (1 commits)")

### Embed Badge

![Health badge](/badges/magepow-customersession/health.svg)

```
[![Health](https://phpackages.com/badges/magepow-customersession/health.svg)](https://phpackages.com/packages/magepow-customersession)
```

###  Alternatives

[magiccart/magicmenu

Make megamenu, dropdown menu, mobile menu easy all in one.

4831.1k](/packages/magiccart-magicmenu)[magepow/categories

Shows categories in the form of a grid or list, on category pages, home page or any other page.

4018.8k](/packages/magepow-categories)[magepow/infinitescroll

Infinite scroll for magento 2 automatically loads product catalog without reloading the page.

1784.6k](/packages/magepow-infinitescroll)[magiccart/magicslider

Banner slider flexibly to any page on live store.

1722.7k](/packages/magiccart-magicslider)[magepow/layerednav

Magento 2 Advanced Layered Navigation Ajax

1712.1k](/packages/magepow-layerednav)[magiccart/lookbook

Pin product to banner easy.

1319.7k](/packages/magiccart-lookbook)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
