PHPackages                             wubinworks/module-injecthead - 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. wubinworks/module-injecthead

ActiveMagento2-module

wubinworks/module-injecthead
============================

1.0.0(2y ago)01451OSL-3.0JavaScriptPHP &gt;=7.3

Since Aug 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/wubinworks/HeadContent)[ Packagist](https://packagist.org/packages/wubinworks/module-injecthead)[ RSS](/packages/wubinworks-module-injecthead/feed)WikiDiscussions master Synced 1mo ago

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

[![Wubinworks_InjectHead_Grid](https://github.com/wubinworks/home/raw/master/images/Wubinworks/InjectHead/grid.png "Wubinworks_InjectHead_Grid")](https://github.com/wubinworks/home/raw/master/images/Wubinworks/InjectHead/grid.png)[![Wubinworks_InjectHead_Code_Editor](https://github.com/wubinworks/home/raw/master/images/Wubinworks/InjectHead/code_editor.png "Wubinworks_InjectHead_Code_Editor")](https://github.com/wubinworks/home/raw/master/images/Wubinworks/InjectHead/code_editor.png)**Head Content Manager(Left)**

**Code Editor(Right)**

*Click image to enlarge*

(日本語)

何のエクステンション？
-----------

[](#何のエクステンション)

簡単に言うと、Magentoの任意のページの要素に、任意の内容(コード)を注入できるエクステンションです。 ルールの一致条件を指定することで、例えば、正規表現のURIパターンで、注入したいページを指定することもできます。 本エクステンションはMagentoキャッシュ機能とブラウザのローカルストレージを利用することで、サーバの負荷を軽減します。

背景
--

[](#背景)

多くの非Magentoプログラマーとサイト管理者の要望により、本エクステンションを開発しました。あんまりMagento経験がない人でも、日常管理やキャンペーンで、サイトを一時変更することも手軽にできます。

機能ハイライト
-------

[](#機能ハイライト)

**Full Page Cache, Fastly, Varnish対応**

- Full Page Cache／Fastly／Varnishを使用しても**顧客グループ**指定可。オリジナルprivate content方法で実現
- サーバからダウンロードした内容をできるだけ長くブラウザにキャッシュさせます(Magento既定のキャッシュ機能より長くキャッシュできる)
- ローカルストレージをフル活用
- サーバへのリクエストを軽減
- バックエンドで細かく設定可能。貴社ビジネスモデルとサーバ環境に一番合う設定を模索しよう
- 何かを間違えても、顧客ブラウザのキャッシュを強制的にアップデートさせることが可能(バックエンド設定:バージョンナンバー)

**ルール開始時刻と終了時刻が指定でき、期間限定キャンペーンなどに活用しやすい**

**ルールに顧客グループ指定可能(複数選択可)**

**ルールにストアビュー指定可能(複数選択可)**

**高度なルール検索機能。複数選択は完全一致と部分一致両方対応**

- たくさんのルールが一元管理できる

**ルール複製: 類似なルールを作るのに便利**

- 複製回数指定可能
- 注意点: 複製されたルールは既定で無効

**高度な一括操作: Magento既定の一括操作と完全に違い、全ての項目を便利に変更可能(開発中)**

**URIパターンとFull Action Nameでマッチ**

- URIパターン正規表現のデリミタは`#`で、デリミタを入力する必要はない
- 大小文字を区別
- Full Action Name一致は開発中

**Rewriteルール逆引き**

- SEOリンクと正規リンクに同一ルールを適用
- 例:`/seo-friendly-url-product.html`と`/category/product/view/id/5678`、開発中

**404などのページを除外できる**

- バックエンドで設定可能。既定で`cms/noroute/index`(404)は既に除外している。他にも追加可能
- ワイルドカード使用可
- todo: FAQセクションで詳しく説明

**HTMLエディタ with 構文強調**

- トップ部分の画像をご参照ください。`CodeMirror`開発チームに感謝します。

**日本語翻訳(&gt;95%翻訳済み)**

**無料、オープンソース、データを収集しない**

- プライバシーポリシーセクションをご参照

他の機能
----

[](#他の機能)

- 設定セクションをご参照

FAQ
-------------------------------------

[](#faq)

##### `部分一致`は`すべて`にマッチしません

[](#部分一致はすべてにマッチしません)

TODO: Add description

##### URIパターン(正規表現)

[](#uriパターン正規表現)

TODO: Add description

##### コードエディタ

[](#コードエディタ)

TODO: Add description

##### キャッシュクリア

[](#キャッシュクリア)

TODO: Add description

##### 除外されるFull Action Name

[](#除外されるfull-action-name)

TODO: Add description

使用事例
----

[](#使用事例)

- キャンペーン用商品: `^/awesome-product-sku102[1-9]\.html`
- メンバーシップ判定: `\?is_member=1`
- チェックアウトページを特定: `^/checkout(/index)?(/index)?((\?.*)?$|/)`

今後の開発計画
-------

[](#今後の開発計画)

- `開発中`をご参照

動作環境
------------------------------------------------------

[](#動作環境)

- Magento 2.4

インストール
------

[](#インストール)

### *下記のインストール方法を1つだけ選んでください！*

[](#下記のインストール方法を1つだけ選んでください)

#### Composerで安定版をインストール(推奨)

[](#composerで安定版をインストール推奨)

`cd `

`composer require wubinworks/module-injecthead 1.0.0`

#### Composerで最新Githubバージョンをインストール

[](#composerで最新githubバージョンをインストール)

`cd `

`composer config repositories.wubinworks-headcontent git https://github.com/wubinworks/HeadContent.git`

`composer require wubinworks/module-injecthead:dev-master`

もしくは、Magentoルート`composer.json`に以下のコードを追加

```
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/wubinworks/HeadContent.git"
        }
    ],
    "require": {
        "wubinworks/module-injecthead": "dev-master"
    }
}

```

次に、 `composer install`

#### 手動インストール

[](#手動インストール)

- エクステンションコードパスを作成(例: `mkdir -p /app/code/Wubinworks/InjectHead`)
- インストールしたいブランチをダウンロードし、`/app/code/Wubinworks/InjectHead/`に解凍(unzip)

### 共通ラストステップ

[](#共通ラストステップ)

`cd `

`php bin/magento setup:upgrade`

`php bin/magento setup:di:compile`

`php bin/magento cache:flush`

#### バックエンドでWubinworksのメニューを確認

[](#バックエンドでwubinworksのメニューを確認)

設定
--

[](#設定)

- エクステンション全体有効／無効
- 除外されたFull Action Name
- ルール複製回数
- Block HTML Cache Lifetime
- クライアントデータCache Lifetime最大値
- バージョンナンバー
- Rewriteルール逆引き
- デバッグモード

プライバシーポリシー
----------

[](#プライバシーポリシー)

[Wubinworksプライバシーポリシー](https://github.com/wubinworks/home/tree/master/privacy-policy)

(English)

What is this Extension?
-----------------------

[](#what-is-this-extension)

To be simple, this extension can inject scripts and css to HTML element. Users can choose which page they want to inject by specifying rules including URI pattern. This module makes use of magento cache and browser local storage to achieve best performance.

Background
----------

[](#background)

As per many common requests from Non-Magento Programmers and Website Admins, this extension provides an all-in-one solution to make their job much easier.

Feature Highlights
------------------

[](#feature-highlights)

**Full Page Cache, Fastly, Varnish support**

- Full Page Cache, Fastly, Varnish tested for different **Customer Groups**. Achieved by using a modified private content way
- caches correct contents downloaded from the source server as long as possible(cache time in general is much longer than Magento default)
- ultilizes the local storage
- less frequent request to server
- there are many settings for this feature at backend. Find the most suitable settings for your business case and server
- can force browser update(check backend setting: version number) in case you made mistake and want to fix it immediately

**Can set rule start &amp; end date time, easy management for campaigns**

**Can set rules for different custmer groups(multiple selection possible)**

**Can set rules for different stores(multiple selection possible)**

**Enhanced rules filter. For multi-select, full match filter and partial match filter are supported**

- this feature becomes very handy when you got like more than 100 rules

**Rule Duplication: Create similar rules much easier**

- can specify duplication times
- note: duplicated rules will be automatically set to Disabled

**Advanced Mass Action: A very different design compared to the Magento default mass action. Almost everything can be bulky modified(under development)**

**Match pages with URI pattern or Full Action Name**

- URI regex pattern delimiter is `#`, you do NOT need to add the delimiter
- case sensitive
- Full Action Name way is under development

**Rewrite rule reverse lookup**

- you don't need to struggle the SEO friendly URL and the canonical one
- eg:`/seo-friendly-url-product.html` and `/category/product/view/id/5678`, under development

**Exclude certain pages, such as 404 page**

- can config it in backend settings. By default, `cms/noroute/index`(404) is excluded and you can add more
- wildcard supported
- todo: add more details to FAQ Section

**A Cute HTML editor with syntax hightlighting**

- see image above, thanks to `CodeMirror`

**Janpanese translation(&gt;95% done)**

**Free, Open Source and No Data Collection**

- see Privacy Policy Section

Other Features
--------------

[](#other-features)

- see Configuration Section

FAQ
----------------------------------

[](#faq-1)

##### `partial match` cannot match `ALL`

[](#partial-match-cannot-match-all)

TODO: Add description

##### URI Pattern(Regular Expression)

[](#uri-patternregular-expression)

TODO: Add description

##### Code Editor

[](#code-editor)

TODO: Add description

##### Cache Clear

[](#cache-clear)

TODO: Add description

##### Excluded Full Action Names

[](#excluded-full-action-names)

TODO: Add description

Use Case
--------

[](#use-case)

- campaign products: `^/awesome-product-sku102[1-9]\.html`
- check membership: `\?is_member=1`
- match checkout page: `^/checkout(/index)?(/index)?((\?.*)?$|/)`

Future Plans
------------

[](#future-plans)

- see `under development`

System Requirements
------------------------------------------------------------------

[](#system-requirements)

- Magento 2.4

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

[](#installation)

### *You can only choose one method!*

[](#you-can-only-choose-one-method)

#### Composer install stable version(Recommended)

[](#composer-install-stable-versionrecommended)

`cd `

`composer require wubinworks/module-injecthead 1.0.0`

#### Composer install latest Github version(For advanced user)

[](#composer-install-latest-github-versionfor-advanced-user)

`cd `

`composer config repositories.wubinworks-headcontent git https://github.com/wubinworks/HeadContent.git`

`composer require wubinworks/module-injecthead:dev-master`

Alternatively, add below to Magento root `composer.json`

```
{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/wubinworks/HeadContent.git"
        }
    ],
    "require": {
        "wubinworks/module-injecthead": "dev-master"
    }
}

```

then, `composer install`

#### Install Manually(For advanced user)

[](#install-manuallyfor-advanced-user)

- Create extension code path(eg: `mkdir -p /app/code/Wubinworks/InjectHead`)
- Download your prefered branch and unzip it to `/app/code/Wubinworks/InjectHead/`

### Common Last Step - Don't forget to run

[](#common-last-step---dont-forget-to-run)

`cd `

`php bin/magento setup:upgrade`

`php bin/magento setup:di:compile`

`php bin/magento cache:flush`

#### Go to backend and check Wubinworks menu

[](#go-to-backend-and-check-wubinworks-menu)

Configuration
-------------

[](#configuration)

- Enable/Disable the entire extension
- Excluded Full Action Names
- Duplication Multiplier
- Block HTML Cache Lifetime
- Maximum Client Data Cache Lifetime
- Version Number
- Reverse Rewrite Rule Lookup
- Debug Mode

Privacy Policy
--------------

[](#privacy-policy)

[Wubinworks Privacy Policy](https://github.com/wubinworks/home/tree/master/privacy-policy)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

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

Unknown

Total

1

Last Release

1012d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7de965a6287fb784969afeb4b173521d3cb59c6b873b7248263abb9fc098eddd?d=identicon)[wubinworks](/maintainers/wubinworks)

---

Top Contributors

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

---

Tags

csscustomer-groupextensionfastlyfull-action-nameheadhtmlinjectjapanesejavascriptlinkmagentomagento2magento2-moduleregexregexpstore-viewstyleurivarnish

### Embed Badge

![Health badge](/badges/wubinworks-module-injecthead/health.svg)

```
[![Health](https://phpackages.com/badges/wubinworks-module-injecthead/health.svg)](https://phpackages.com/packages/wubinworks-module-injecthead)
```

###  Alternatives

[dotdigital/dotdigital-magento2-extension

Dotdigital for Magento 2

50374.2k18](/packages/dotdigital-dotdigital-magento2-extension)[mollie/magento2

Mollie Payment Module for Magento 2

1121.6M10](/packages/mollie-magento2)[swissup/module-search-mysql-legacy

Legacy mysql search for magento 2.4

10483.0k](/packages/swissup-module-search-mysql-legacy)[pagbank/payment-magento

PagBank - Payment for Magento and Adobe

2128.3k7](/packages/pagbank-payment-magento)[fredden/magento2-module-javascript-error-reporting

A Magento 2 module which captures JavaScript errors for later review by website administrators

3138.1k](/packages/fredden-magento2-module-javascript-error-reporting)[mage-os/module-inventory-reservations-grid

Add a grid with the list of inventory reservations.

126.8k](/packages/mage-os-module-inventory-reservations-grid)

PHPackages © 2026

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