PHPackages                             setono/sylius-static-contexts-bundle - 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. setono/sylius-static-contexts-bundle

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

setono/sylius-static-contexts-bundle
====================================

A Symfony bundle that gives you static contexts

v2.0.0(2mo ago)07.0kMITPHPPHP &gt;=8.2CI passing

Since Mar 7Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/Setono/sylius-static-contexts-bundle)[ Packagist](https://packagist.org/packages/setono/sylius-static-contexts-bundle)[ RSS](/packages/setono-sylius-static-contexts-bundle/feed)WikiDiscussions 2.x Synced 2d ago

READMEChangelog (2)Dependencies (29)Versions (5)Used By (0)

Sylius Static Contexts Bundle
=============================

[](#sylius-static-contexts-bundle)

[![Latest Version](https://camo.githubusercontent.com/6527a6e87082a08334c509c09278e1ebb0f6d372cf876c3d52caa28804e5cedf/68747470733a2f2f706f7365722e707567782e6f72672f7365746f6e6f2f73796c6975732d7374617469632d636f6e74657874732d62756e646c652f762f737461626c65)](https://packagist.org/packages/setono/sylius-static-contexts-bundle)[![Software License](https://camo.githubusercontent.com/5c0e72470ee212c03c41583d8adf695c9ca72cda76621e4a408a7b328ebc2415/68747470733a2f2f706f7365722e707567782e6f72672f7365746f6e6f2f73796c6975732d7374617469632d636f6e74657874732d62756e646c652f6c6963656e7365)](LICENSE)[![Build Status](https://github.com/Setono/sylius-static-contexts-bundle/workflows/build/badge.svg)](https://github.com/Setono/sylius-static-contexts-bundle/actions)[![Code Coverage](https://camo.githubusercontent.com/df5f388eae7c480e4a984ec55a6c9207c6faaf1548df382fdc08116b9608007a/68747470733a2f2f636f6465636f762e696f2f67682f5365746f6e6f2f73796c6975732d7374617469632d636f6e74657874732d62756e646c652f6272616e63682f322e782f67726170682f62616467652e737667)](https://codecov.io/gh/Setono/sylius-static-contexts-bundle)[![Mutation testing](https://camo.githubusercontent.com/9feaed2b4cde5962dc00d8b78b7ec63b336aa7f65143b556d0cdc7c967f2fc0b/68747470733a2f2f696d672e736869656c64732e696f2f656e64706f696e743f7374796c653d666c61742675726c3d687474707325334125324625324662616467652d6170692e737472796b65722d6d757461746f722e696f2532466769746875622e636f6d2532465365746f6e6f25324673796c6975732d7374617469632d636f6e74657874732d62756e646c65253246322e78)](https://dashboard.stryker-mutator.io/reports/github.com/Setono/sylius-static-contexts-bundle/2.x)

Provides static channel and locale contexts for Sylius. This allows you to set the channel and locale programmatically instead of relying on HTTP request resolution — useful for CLI commands, message handlers, and testing.

Both contexts are registered at priority 256, so they take precedence over Sylius's default request-based contexts whenever a value is set.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- Symfony ^6.4 || ^7.4
- Sylius v2

> For Sylius v1 support, use the `1.x` branch.

Installation
------------

[](#installation)

```
composer require setono/sylius-static-contexts-bundle
```

Usage
-----

[](#usage)

### Setting the channel

[](#setting-the-channel)

```
use Setono\SyliusStaticContextsBundle\Context\StaticChannelContext;

final class YourCommand extends Command
{
    public function __construct(private readonly StaticChannelContext $channelContext)
    {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        // Set by channel code (looks up the channel via the repository)
        $this->channelContext->setChannelCode('web_us');

        // Or set by channel object directly
        $this->channelContext->setChannel($channel);

        // Now any service that depends on ChannelContextInterface
        // will resolve to this channel
        // ...

        // Reset when done (also happens automatically via Symfony's ResetInterface)
        $this->channelContext->reset();

        return Command::SUCCESS;
    }
}
```

### Setting the locale

[](#setting-the-locale)

```
use Setono\SyliusStaticContextsBundle\Context\StaticLocaleContext;

final class YourCommand extends Command
{
    public function __construct(private readonly StaticLocaleContext $localeContext)
    {
        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->localeContext->setLocaleCode('en_US');

        // Now any service that depends on LocaleContextInterface
        // will resolve to this locale
        // ...

        $this->localeContext->reset();

        return Command::SUCCESS;
    }
}
```

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance84

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~134 days

Total

4

Last Release

82d ago

Major Versions

v1.0.0 → 2.x-dev2026-04-13

PHP version history (2 changes)1.x-devPHP &gt;=8.1

2.x-devPHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2412177?v=4)[Joachim Løvgaard](/maintainers/loevgaard)[@loevgaard](https://github.com/loevgaard)

---

Top Contributors

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

---

Tags

phpsyliussymfonysymfony-bundle

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/setono-sylius-static-contexts-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/setono-sylius-static-contexts-bundle/health.svg)](https://phpackages.com/packages/setono-sylius-static-contexts-bundle)
```

PHPackages © 2026

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