承接 alengo/sulu-http-cache-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alengo/sulu-http-cache-bundle

Composer 安装命令:

composer require alengo/sulu-http-cache-bundle

包简介

HTTP cache helpers for Sulu/Symfony: strip tracking query parameters and store CTA marketing-attribution cookies at the reverse-proxy layer.

README 文档

README

HTTP-cache helpers for Sulu / Symfony, wired onto the FOS EventDispatchingHttpCache (reverse-proxy) kernel:

  • StripQueryParametersSubscriber — removes tracking query parameters (utm_*, gclid, fbclid, …) at PRE_HANDLE, before the cache key is computed, so tracking-param URL permutations collapse onto a single cache entry.
  • CtaInterestsSubscriber — stores matched tracking parameters in a cookie (default cta_interests) for marketing attribution.
  • CtaRefererSubscriber — stores an external referer in a cookie (default cta_referer).

The CTA cookies are written in POST_HANDLE (after the store decision) so they are set per response and never baked into a cached page.

Installation

composer require alengo/sulu-http-cache-bundle

Register the bundle (Symfony Flex does this automatically):

// config/bundles.php
Alengo\SuluHttpCacheBundle\AlengoHttpCacheBundle::class => ['all' => true],

Wiring

The subscribers run on the reverse-proxy cache kernel, which is created in the front controller / Kernel::getHttpCache() before the DI container is available. Wire them with the provided configurator:

use Alengo\SuluHttpCacheBundle\Cache\CacheKernelConfigurator;

public function getHttpCache(): HttpKernelInterface
{
    if (!$this->httpCache instanceof HttpKernelInterface) {
        $cache = new SuluHttpCache($this);

        (new CacheKernelConfigurator())->configure(
            $cache->getEventDispatcher(),
            $this->getProjectDir(),
            $this->getEnvironment(),
        );

        $this->httpCache = $cache;
    }

    return $this->httpCache;
}

Configuration

All settings live in config/packages/alengo_http_cache.yaml. The configurator reads this file directly at runtime (no container), so keep the values inline — cross-file imports and %env()% placeholders are not resolved. Defaults are applied for anything omitted.

alengo_http_cache:
    strip_query_parameters:
        enabled: true
        # deny_list: ['utm_[a-z]+', 'gclid', ...]   # defaults to the built-in tracking list
        # allow_list: []
    cta_interests:
        enabled: true
        cookie_name: cta_interests
        # allow_list: [...]                          # defaults to the built-in tracking list
    cta_referer:
        enabled: true
        cookie_name: cta_referer

Each subscriber can be switched off with enabled: false. The resolved cookie names are also exposed as the container parameters alengo_http_cache.cta_interests.cookie_name and alengo_http_cache.cta_referer.cookie_name for container-side consumers (e.g. a form controller that reads the cookie).

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固