PHPackages                             hk2/addbootstrap5 - 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. hk2/addbootstrap5

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

hk2/addbootstrap5
=================

Magento 2 extension that enables administrators to load Bootstrap 4 or Bootstrap 5 on the storefront without modifying theme files or creating child themes.

3.1.0(1mo ago)18301OSL-3.0PHPPHP ^8.1 || ^8.2 || ^8.3 || ^8.4CI passing

Since Jun 15Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/basantmandal/magento2-bootstrap5-module)[ Packagist](https://packagist.org/packages/hk2/addbootstrap5)[ RSS](/packages/hk2-addbootstrap5/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (8)Dependencies (7)Versions (13)Used By (0)

HK2 Add Bootstrap 5
===================

[](#hk2-add-bootstrap-5)

[![Version](https://camo.githubusercontent.com/25e5293de9efa661e3a4e7940c403263a3fed20c661d878cc373e10e4ed580f6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d332e302e302d626c75653f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/25e5293de9efa661e3a4e7940c403263a3fed20c661d878cc373e10e4ed580f6/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d332e302e302d626c75653f7374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/a3fd2257982f64afbde00a66a8ab5984ee3f6e176f00eb2ec4ea61d862bc113b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4f534c2d2d332e302d677265656e3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/a3fd2257982f64afbde00a66a8ab5984ee3f6e176f00eb2ec4ea61d862bc113b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4f534c2d2d332e302d677265656e3f7374796c653d666c61742d737175617265)[![Magento](https://camo.githubusercontent.com/5c0e69cb7da2670c8c31d9baa7de3bb6e955ec4847f236b0c025d24cd587ac54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6167656e746f2d322e342e342d2d322e342e392d6639373331363f7374796c653d666c61742d737175617265266c6f676f3d6d6167656e746f266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/5c0e69cb7da2670c8c31d9baa7de3bb6e955ec4847f236b0c025d24cd587ac54/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4d6167656e746f2d322e342e342d2d322e342e392d6639373331363f7374796c653d666c61742d737175617265266c6f676f3d6d6167656e746f266c6f676f436f6c6f723d7768697465)[![PHP](https://camo.githubusercontent.com/ad4f93eecb5fbaab9df06144c39ec979001e451fe5c303f11692bf6ba2aa14b8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e31253230253743253743253230382e32253230253743253743253230382e33253230253743253743253230382e342d3763336165643f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/ad4f93eecb5fbaab9df06144c39ec979001e451fe5c303f11692bf6ba2aa14b8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e31253230253743253743253230382e32253230253743253743253230382e33253230253743253743253230382e342d3763336165643f7374796c653d666c61742d737175617265266c6f676f3d706870266c6f676f436f6c6f723d7768697465)[![Downloads](https://camo.githubusercontent.com/05ba2b590ba75c0c6fb444afd7c2cc4bda684a7c8a0e14537cb54734cfc9c214/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f686b322f616464626f6f747374726170353f7374796c653d666c61742d737175617265)](https://packagist.org/packages/hk2/addbootstrap5)

Overview
--------

[](#overview)

HK2 Add Bootstrap 5 is a Magento 2 extension that enables store administrators to load Bootstrap 4 or Bootstrap 5 on the storefront. This is accomplished without modifying any theme files or creating child themes, allowing for rapid and modular frontend design integration.

🎯 Use Cases
-----------

[](#-use-cases)

- **Custom Styling**: Easily style storefront templates with Bootstrap utilities.
- **Theme Development**: Prototyping pages and layouts without setting up local asset pipelines.

🚀 Features
----------

[](#-features)

- 🎨 Integrates Bootstrap 4 or 5 onto the storefront without child themes.
- ⚡ Asynchronously loads JS via a RequireJS-compatible inclusion pattern.
- ⚙️ Adds an Admin Panel configuration for selecting version and CDN provider.
- 🛠 Provides a demo route (`addbootstrap5/demo/index`) to verify styles.
- 🔒 Whitelists CDNs in `etc/csp_whitelist.xml` to prevent CSP violations.

🏗 Architecture
--------------

[](#-architecture)

- **Block**: `HK2\AddBootstrap5\Block\Bootstrap\BootstrapAssets` manages stylesheet and javascript dynamic inclusion logic.
- **Controller**: `HK2\AddBootstrap5\Controller\Demo\Index` serves the Bootstrap demonstration page.

🧩 Magento Components
--------------------

[](#-magento-components)

### Blocks

[](#blocks)

- `HK2\AddBootstrap5\Block\Bootstrap\BootstrapAssets`
- `HK2\AddBootstrap5\Block\Demo\Index`
- `HK2\AddBootstrap5\Block\Adminhtml\System\Config\DemoLinkV4`
- `HK2\AddBootstrap5\Block\Adminhtml\System\Config\DemoLinkV5`

### Controllers

[](#controllers)

- `HK2\AddBootstrap5\Controller\Demo\Index`

### Layout XML

[](#layout-xml)

- `view/frontend/layout/default.xml` - Loads asset inclusion block.
- `view/frontend/layout/addbootstrap5_demo_index.xml` - Sets up the demo page layout.

📦 Requirements
--------------

[](#-requirements)

- **Magento version**: 2.4.4 - 2.4.9
- **PHP requirements**: 8.1 || 8.2 || 8.3 || 8.4
- **Required Extension**: `HK2_Core`

⚙️ Installation
---------------

[](#️-installation)

1. `composer require hk2/addbootstrap5`
2. `bin/magento module:enable HK2_AddBootstrap5`
3. `bin/magento setup:upgrade`
4. `bin/magento setup:di:compile`
5. `bin/magento cache:flush`

🔧 Configuration
---------------

[](#-configuration)

Configure settings under **Stores &gt; Configuration &gt; HK2 &gt; Add Bootstrap5**:

FieldDescription**Enable Extension**Enable or disable the Bootstrap asset loading globally.**Select Bootstrap Version**Choose Bootstrap 4 (4.4.1, 4.5.3, 4.6.2) or 5 (5.0.2, 5.1.3, 5.2.3, 5.3.8).**Select CDN Provider**Select CDN host (`jsDelivr`, `cdnjs`, `unpkg`).**Enable Debug Mode**If enabled, prints version and CDN metadata to the browser console.Usage
-----

[](#usage)

Navigate to the frontend route `{{base_url}}/addbootstrap5/demo/index` to verify that Bootstrap is working. You can append `?version=4` or `?version=5` to test respective versions.

🗄 Database Changes
------------------

[](#-database-changes)

Not Applicable

📂 Module Structure
------------------

[](#-module-structure)

```
Block/
├── Adminhtml/
│   └── System/
│       └── Config/
│           ├── DemoLinkV4.php
│           └── DemoLinkV5.php
├── Bootstrap/
│   └── BootstrapAssets.php
└── Demo/
    └── Index.php
Controller/
└── Demo/
    └── Index.php
etc/
├── adminhtml/
│   ├── menu.xml
│   ├── routes.xml
│   └── system.xml
├── frontend/
│   └── routes.xml
├── acl.xml
├── config.xml
├── csp_whitelist.xml
└── module.xml
view/
└── frontend/
    ├── layout/
    │   ├── addbootstrap5_demo_index.xml
    │   └── default.xml
    ├── templates/
    │   ├── bootstrap/
    │   │   └── include.phtml
    │   └── demo/
    │       └── index.phtml
    └── web/
        └── js/
            └── bootstrap-debug.js

```

📈 Performance Considerations
----------------------------

[](#-performance-considerations)

The JS bundle is loaded asynchronously and only after the load event, preventing blocking of DOM layout calculations.

🔐 Security Considerations
-------------------------

[](#-security-considerations)

- **CSP Whitelisting**: Out-of-the-box whitelisting for CDNs (jsDelivr, unpkg, cdnjs) is configured in `etc/csp_whitelist.xml` to satisfy standard Magento Content Security Policies.

Compatibility
-------------

[](#compatibility)

Reference: [docs/compatibility.md](docs/compatibility.md)

PlatformSupported VersionsMagento2.4.4 - 2.4.9PHP8.1, 8.2, 8.3, 8.4🛠 Troubleshooting
-----------------

[](#-troubleshooting)

### RequireJS/AMD Conflicts

[](#requirejsamd-conflicts)

If third-party scripts fail with AMD conflicts on the page after enabling Bootstrap, the RequireJS-wrapper inside `include.phtml` restores `window.define.amd` safely. Ensure no other module interferes with script loads.

### CSP Errors in Console

[](#csp-errors-in-console)

Verify that the `HK2_Csp` module is active or that your web server allows connections to selected CDNs.

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! If you'd like to improve the installer:

- ⭐ **Star this repository** (Helps others find it!)
- 🍴 Fork the project
- 🐛 Report bugs
- 💡 Suggest new features
- 🤝 Contribute improvements

Every ⭐ helps increase the visibility of the project and motivates further development.

⚖️ Disclaimer
-------------

[](#️-disclaimer)

The author provides this installation script "as is" without any warranties. Users are responsible for ensuring that running this script complies with their internal security and software requirements.

---

🤝 Support
---------

[](#-support)

For bug reports, feature requests, and general support:

- **Author**: Basant Mandal
- **Email**:
- **Website**:

License
-------

[](#license)

This project is licensed under the OSL 3.0 License. See the [LICENSE.txt](LICENSE.txt) file for details.

---

###  Health Score

53

—

FairBetter than 96% of packages

Maintenance93

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 96.2% 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 ~149 days

Recently: every ~16 days

Total

11

Last Release

34d ago

Major Versions

1.0.0 → 2.0.02023-08-09

2.1.0 → 3.1.12026-05-11

PHP version history (3 changes)1.0.0PHP ^7.3.0|^7.4.0|^8.0|^8.1.0

2.0.0PHP ^7.3.0|^7.4.0|^8.0|^8.1.0|^8.2.0

3.1.1PHP ^8.1 || ^8.2 || ^8.3 || ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/ffa270f1557c4c55c55fec1ad6f2544170980c8dd7f679c10582a3736f7d3a4c?d=identicon)[basantmandal](/maintainers/basantmandal)

---

Top Contributors

[![basantmandal](https://avatars.githubusercontent.com/u/69835601?v=4)](https://github.com/basantmandal "basantmandal (51 commits)")[![semantic-release-bot](https://avatars.githubusercontent.com/u/32174276?v=4)](https://github.com/semantic-release-bot "semantic-release-bot (2 commits)")

---

Tags

bootstrapbootstrap5hk2magento2magento2-extension-freemagento2-module-freebootstrapmagento2bootstrap5bootstrap4HK2Basantmagento moduleaddbootstrap5basantmandal

### Embed Badge

![Health badge](/badges/hk2-addbootstrap5/health.svg)

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

###  Alternatives

[run-as-root/magento2-prometheus-exporter

Magento2 Prometheus Exporter

69362.0k](/packages/run-as-root-magento2-prometheus-exporter)[myparcelnl/magento

A Magento 2 module that creates MyParcel labels

1861.2k](/packages/myparcelnl-magento)[smile/module-store-locator

Smile Store Locator

51537.6k5](/packages/smile-module-store-locator)[angeo/module-llms-txt

Magento 2 module for AI Engine Optimization (AEO). Generates spec-compliant llms.txt and llms-full.txt per llmstxt.org standard, plus streaming JSONL for vector indexing. Multi-store, multi-website, CLI, cron, async admin UI, Page Builder-aware sanitization, customer-group pricing, atomic writes, ETag/Cache-Control, .md mirrors.

132.2k](/packages/angeo-module-llms-txt)[mage-os/module-llm-txt

AI-powered LLMs.txt generation for Magento 2 / Mage-OS stores. Help AI systems understand your store with OpenAI-generated content.

245.7k](/packages/mage-os-module-llm-txt)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1015.1k29](/packages/loki-magento2-components)

PHPackages © 2026

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