PHPackages                             neutromelabs/magento2-ssr-graphql - 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. [API Development](/categories/api)
4. /
5. neutromelabs/magento2-ssr-graphql

ActiveMagento2-module[API Development](/categories/api)

neutromelabs/magento2-ssr-graphql
=================================

Allows to preload graphql queries at the render time

0.1.2(6mo ago)5141GPL-3.0-or-laterPHP

Since Jul 19Pushed 6mo agoCompare

[ Source](https://github.com/neutrome-labs/magento2-ssr-graphql)[ Packagist](https://packagist.org/packages/neutromelabs/magento2-ssr-graphql)[ RSS](/packages/neutromelabs-magento2-ssr-graphql/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

```
There should not be one to choose between PHP and GraphQL.
Revolutionize your customer's experience with the best from both.

```

Magento 2 SSR GraphQL Module
============================

[](#magento-2-ssr-graphql-module)

Adds SSR GraphQL resolving capabilities to any Magento 2 frontend. Compatible with any theme. Works best with AlpineJS.

Overview
--------

[](#overview)

The idea is to write a normal GraphQL `query`, (which will be used on the frontend via JS,) AND automatically preload it's `response` at the page render, providing JS code with instant `data`/`errors` - without executing the "first" Ajax request.

Then, JS should operate as normal, with the access both to the `query` string, `ssr` data (variables, response) and simplified `fetch()`, to repeat the query, optionally passing new parameters.

Where To Use
------------

[](#where-to-use)

Anywhere on your pages, when the *same* \[available via GraphQL\] content needs to be available to the customer at the page render time (PHP), while could be updated later (JS).

Typical use-cases:

- pagination/lazy-load - the first set of the items could be preloaded at the page render, and paginated later, with the same GraphQL `query` and different `variables`
- double-check - the "Add To Cart" button is rendered if the product is available for sale, and the same query is `refresh`-ed on click, to prevent stock races

How To Use
----------

[](#how-to-use)

Simple example - paginated product list, over GraphQL.

1. The `phtml` view must call the `makeSsrGqlCall(query, variables)` method, from the `NeutromeLabs\SsrGraphql\ViewModel\SsrGraphqlViewModel` view model, which returns JS fragment string representing `object`, to insert into the page html script tag.

```
var ssrGqlExampleObject = ;
renderData(); // some logic to present ssrGqlExampleObject to the customer

```

2. While rendering this page, Magento will resolve the passed query and provide `ssrGqlExampleObject` JS variable with a special SSR GraphQL `object`

```
{
    // indicates, if the response is SSR-generated. true, if no "refresh" calls were made
    fresh: boolean,
    // "current" response data
    data?: object,
     // "current" response errors
    errors?: object[],
    ssr: {
        query: string, // GraphQL query string
        variables: object, // GraphQL variables, passed at the step 1
        response: object, // SSR GraphQL response
    },
    // fetches the same query with the merged variables from the ssr.variables and parameter
    fetch: (variables?: object) => Promise,
    // fetch(), then update the inner data and errors fields with the new response
    refresh: (variables?: object) => Promise,
}

```

3. The data from the JS variable could be presented to the customer right after the page load, with no "loaders" on the screen. Then those data could be updated, without the need to repeat the same GraphQL query again

```
currentPage++;

ssrGqlExampleObject.refresh({
    currentPage: currentPage
}).then(() => {
    renderData();
})

```

See the full example at `https://your-magento-instance.test/ssrgql/example`, and [src/SsrGraphql/view/frontend/templates/example/1.phtml](src/SsrGraphql/view/frontend/templates/example/1.phtml)

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance69

Regular maintenance activity

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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

Every ~267 days

Total

3

Last Release

180d ago

### Community

Maintainers

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

---

Top Contributors

[![theuargb](https://avatars.githubusercontent.com/u/83121880?v=4)](https://github.com/theuargb "theuargb (4 commits)")

---

Tags

hyva-themesmagento2

### Embed Badge

![Health badge](/badges/neutromelabs-magento2-ssr-graphql/health.svg)

```
[![Health](https://phpackages.com/badges/neutromelabs-magento2-ssr-graphql/health.svg)](https://phpackages.com/packages/neutromelabs-magento2-ssr-graphql)
```

###  Alternatives

[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8064.7M49](/packages/smile-elasticsuite)[mollie/magento2

Mollie Payment Module for Magento 2

1131.9M16](/packages/mollie-magento2)[adyen/module-payment

Official Magento2 Plugin to connect to Payment Service Provider Adyen.

1673.2M10](/packages/adyen-module-payment)[magmodules/magento2-channable

Channable integration for Magento 2

311.5M](/packages/magmodules-magento2-channable)[elgentos/module-prismicio

Magento 2 - Prismic.io integration

39119.0k4](/packages/elgentos-module-prismicio)[graycore/magento2-graphql-introspection-cache

1017.3k](/packages/graycore-magento2-graphql-introspection-cache)

PHPackages © 2026

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