# hk2/core

> HK2 Core module - The foundational base module for all Magento 2 HK2 extensions.

`composer require hk2/core`

Canonical URL: https://packagento.com/hk2/core

## At a glance

- **Vendor**: hk2 (https://packagento.com/hk2.md)
- **Latest version**: v1.0.0 — released 2026-07-16
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/hk2/core and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require hk2/core:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

HK2 Core module - The foundational base module for all Magento 2 HK2 extensions.

## README

![Version](https://img.shields.io/badge/version-1.1.0-blue?style=flat-square)
![License](https://img.shields.io/badge/license-OSL--3.0-green?style=flat-square)
![Magento](https://img.shields.io/badge/Magento-2.4.4--2.4.9-f97316?style=flat-square&logo=magento&logoColor=white)
![PHP](https://img.shields.io/badge/PHP-8.1%20%7C%7C%208.2%20%7C%7C%208.3%20%7C%7C%208.4-7c3aed?style=flat-square&logo=php&logoColor=white)
[![Downloads](https://img.shields.io/packagist/dt/hk2/core?style=flat-square)](https://packagist.org/packages/hk2/core)

### Overview

The HK2 Core module is the foundational base module for all Magento 2 HK2 extensions. It establishes standard administrative configurations, reusable backend blocks, and standardized headers for module configuration screens.

### 🎯 Use Cases

- **Module Base**: Required by all other HK2 extensions (AddBootstrap5, CSP, ScrollTop, etc.) to function correctly.
- **Admin Consolidation**: Consolidates HK2 module configurations into a single, organized tab in the Magento Admin Panel.

### 🚀 Features

- ⚙️ Registers a centralized "HK2 Extensions" configuration tab.
- 📂 Sets up a main admin menu item under System for HK2.
- 🔒 Implements a root ACL resource for all HK2 modules.
- 🎨 Provides a reusable `ModuleHeader` block for consistent branding.

### 🏗 Architecture

- **Core Module Components**: Base adminhtml system configurations.
- **Design Patterns**: Standard Magento UI configuration implementations.

### 🧩 Magento Components

#### Blocks

- `HK2\Core\Block\Adminhtml\System\Config\ModuleHeader`

#### Layout XML

- `HK2_Core::system/config/module_header.phtml`

### 📦 Requirements

- **Magento version**: 2.4.4 - 2.4.9
- **PHP requirements**: 8.1 || 8.2 || 8.3 || 8.4
- **Composer requirements**: `magento/framework: ^103.0.0`

### ⚙️ Installation

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

### 🔧 Configuration

This module primarily provides configuration tabs for other modules. No specific configuration is required for the Core module itself.

### Usage

This module works silently in the background. Once installed, navigating to **Stores > Configuration** will display a new "HK2" tab where dependent modules will render their settings.

### 🗄 Database Changes

Not Applicable

### 📂 Module Structure

```text
Block/
├── Adminhtml/
│   └── System/
│       └── Config/
│           └── ModuleHeader.php
etc/
├── adminhtml/
│   ├── menu.xml
│   └── system.xml
├── acl.xml
└── module.xml
view/
└── adminhtml/
    └── templates/
        └── system/
            └── config/
                └── module_header.phtml
```

### 🧪 Testing

Not Applicable

### 📈 Performance Considerations

Not Applicable

### 🔐 Security Considerations

- **ACL usage**: Defines `HK2_Core::root` base ACL for administrative access to HK2 configurations.

### Compatibility

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

| Platform | Supported Versions |
|----------|-------------------|
| Magento  | 2.4.4 - 2.4.9     |
| PHP      | 8.1, 8.2, 8.3, 8.4 |

### 🔄 Upgrade Notes

Not Applicable

### 🛠 Troubleshooting

If HK2 tabs do not appear in the admin panel, ensure that the cache has been flushed and `HK2_Core` is enabled using `bin/magento module:status`.

### 🤝 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

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

For bug reports, feature requests, and general support:

- **Author**: Basant Mandal
- **Email**: <support@basantmandal.in>
- **Website**: <https://www.basantmandal.in>

### License

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

---

## Changelog

#### ⚠ BREAKING CHANGES

* add HK2 Core module with initial files and configurations

#### ✨ Features

* add HK2 Core module with initial files and configurations ([0a349e4](https://github.com/basantmandal/magento2-hk2-core-module/commit/0a349e408b02de4b43e8233ea51163e1fb9cd871))

## Recent Versions

| Version | Released |
|---|---|
| v1.0.0 | 2026-07-16 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| magento/framework | ^103.0.0 |
| php | ^8.1 \|\| ^8.2 \|\| ^8.3 \|\| ^8.4 |

## Quality

Latest release (v1.0.0) passes the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — a phpcs finding can't make a module incompatible.

#### Static Analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Pass | 0 |  |
| PHPMD | Pass | 0 |  |
| Cpd | Pass | 0 |  |
| Composer validate | Pass | 0 |  |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |

#### Integration Tests

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | – | – |
| 2.4.8 | – | N/A | N/A | – |
| 2.4.9 | – | – | N/A | N/A |


### Security

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["hk2/core"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

hk2 is a Magento 2 vendor on Packagento. See https://packagento.com/hk2.md for their full catalogue.

