# loki/magento2-admin-components

> Admin Panel grids and forms created via Loki Components

`composer require loki/magento2-admin-components`

Canonical URL: https://packagento.com/loki/magento2-admin-components

## At a glance

- **Vendor**: loki (https://packagento.com/loki.md)
- **Latest version**: 0.6.4 — released 2026-05-05
- **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/loki/magento2-admin-components 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 loki/magento2-admin-components:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Admin Panel grids and forms created via Loki Components

## README

**This Magento 2 module allows for developers to build admin grids and admin forms in the Magento 2 Admin Panel in
a faster way. No more ugly UiComponents that nobody understands. Create grids and forms quickly. And gradually add
features to them, without getting stuck.**

The LokiAdminComponents are based on the [Loki Components](https://github.com/LokiExtensions/Loki_Components) module which is also used in the [LokiCheckout](https://loki-checkout.com/). However, this admin tool shows that the Loki Extension suite can be applied in many more places.

*Note that this library makes use of Alpine.js in the Magento Admin Panel. As for CSS, we stick to the native Magento Admin Panel classes instead: Everything looks the same.*

### Installation
```bash
composer require loki/magento2-admin-components
bin/magento module:enable Loki_AdminComponents Loki_Components Loki_CssUtils Loki_Base
```

### Getting started with a grid
First create a module that generates a page in the Admin Panel (`etc/module.xml`, `registration.php`, a backend controller action class, perhaps `acl.xml` and `menu.xml`). 

In your new XML layout file, add the following:

```xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:View/Layout:etc/page_configuration.xsd">
    <update handle="loki_admin_components_grid"/>

    <body>
        <referenceContainer name="content">
            <block
                name="yireo-training.example-admin.grid"
                template="Loki_AdminComponents::grid.phtml">
                <arguments>
                    <argument name="provider" xsi:type="string">
                        Magento\Catalog\Api\ProductRepositoryInterface
                    </argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>
```

And you're done. After refreshing the Magento cache, you now have a product grid.

Refer to the [documentation](https://loki-extensions.com/docs/admin-components/grid) for fine-tuning this grid.

### Getting started with a form
Again, first create a module that generates a page in the Admin Panel (`etc/module.xml`, `registration.php`, a backend controller action class, perhaps `acl.xml` and `menu.xml`).

In your new XML layout file, add the following:

```xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:View/Layout:etc/page_configuration.xsd">
    <update handle="loki_admin_components_form"/>

    <body>
        <referenceContainer name="content">
            <block
                name="yireo-training.example-admin.form"
                template="Loki_AdminComponents::form.phtml">
                <arguments>
                    <argument name="provider" xsi:type="string">
                        Magento\Catalog\Api\ProductRepositoryInterface
                    </argument>
                </arguments>
            </block>
        </referenceContainer>
    </body>
</page>
```

And you're done. After refreshing the Magento cache, you now have a basic product form.

Refer to the [documentation](https://loki-extensions.com/docs/admin-components/form) for fine-tuning this form.

### Examples
As a demo, you could opt to install the following examples:

- [YireoTraining_ExampleLokiAdminProducts](https://github.com/yireo-training/YireoTraining_ExampleLokiAdminProducts) - a product repository-based grid with various modifications including inline editing of the product name; 
- [YireoTraining_ExampleLokiAdminCmsPage](https://github.com/yireo-training/YireoTraining_ExampleLokiAdminCmsPage) - a bare-bones repository-based implementation that is ugly, but it shows what you get with minimal effort;
- [YireoTraining_ExampleLokiAdminArrayGrid](https://github.com/yireo-training/YireoTraining_ExampleLokiAdminArrayGrid) - a bare-bones array-based grid;
- [YireoTraining_YireoTraining_ExampleLokiAdminEavEntityType](https://github.com/yireo-training/YireoTraining_YireoTraining_ExampleLokiAdminEavEntityType) - a bare-bones collection-based grid to display EAV entity types;

![Screenshot of YireoTraining_ExampleLokiAdminProducts](loki-admin-grid-products.png)

### Features

#### Grid features
- Autodetection of columns
- Search
- Pagination
- Sorting columns
- Custom cell templates
- Inline editing
- Filters
- Mass Actions
- Custom cell templates
- ... (more docs coming soon)

#### Grid provider handlers
- `repository`
- `collection`
- `array`

#### Form features
- Autodetection of columns
- Field-types (select, text, number, datetime, etc) with option to configure more
- Form actions (Back, Save and Close, Save and Continue, Delete, etc)
- ... (more docs coming soon)

#### Documentation
See [https://loki-extensions.com/docs/admin-components](https://loki-extensions.com/docs/admin-components)

## Todo
- Extension Attributes
- Filesystem navigation
- Tiles instead of grid layout
- Delete add confirmation
- Add custom SearchCriteriaBuilder via repository addons
- Switch field for enabled/disabled column within grid
- Export selected to CSV, JSON, XSLX

## Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### [Unreleased]

### [0.6.4] - 05 May 2026
#### Fixed
- Fix sorting of countries
- Add cell template for just HTML
- Allow textarea to determine rows

### [0.6.3] - 01 May 2026
#### Fixed
- Fix issue with massactions only selecting first item
- New multiselect field type (even though this already was possible with select)
- New Yesno options model

### [0.6.2] - 02 March 2026
#### Fixed
- Fix JavaScript TypeError: columns initialized as object instead of array

### [0.6.1] - 20 February 2026
#### Fixed
- Add `#[\ReturnTypeWillChange]` to allow for removal of `mixed` type hint

### [0.6.0] - 12 February 2026
#### Added
- Category selection input implementation #14 @rajeev-k-tomy

#### Fixed
- Fix intermittent issues where `this.data.id` is not available with `category_selection` Alpine components @rajeev-k-tomy
- Avoid sending children infor as part of UI data from CategoryTreeNode DTO @rajeev-k-tomy
- Change `category_selection` input alpine component name to CategorySelection @rajeev-k-tomy
- Remove unnecessary classes from `category_selection/select_inner_item.phtml` @rajeev-k-tomy
- Separate main script from the main template of category selection

### [0.5.2] - 28 January 2026
#### Fixed
- Add hidden-attribute to field-blocks
- Fix new field types not having proper interface
- Fix when there are no fieldset definitions
- Allow Options-model to be either string or object
- #8 Allow to set label for the base fieldset @rajeev-k-tomy
- #4 Custom fields configured via layout xml file are not appearing in the form @rajeev-k-tomy
- Resolve select field options from the Select field type class
- #3 Create an abstract FieldType class to give access Field instance in every FieldType @rajeev-k-tomy

### [0.5.1] - 23 January 2026
#### Fixed
- Do not escape JSON
- Make sure visible-flag of columns defaults to true

### [0.5.0] - 21 January 2026
#### Added
- Finalize `entity_select`, add type `product_select` and `customer_select`

#### Fixed
- Allow fields defined in XML layout only (without provider)

### [0.4.4] - 12 January 2026
#### Fixed
- Add new GitHub Action workflows
- Copy generic CI/CD files
- Implement required fields in a simple way
- Implement filtering for array grids
- Allow using `searchable_fields` to *restrict* which fields are searched by the ArrayHandler

### [0.4.3] - 30 December 2025
#### Fixed
- Default unknown field types to `input`
- Add field dependencies
- Allow for fieldsets
- Redirect massactions simply to current page
- WIP UiComponents

### [0.4.2] - 21 November 2025
#### Fixed
- First draft of new entity select field
- Allow both Alpine method and regular JS call in cell actions
- Allow for cell actions to be Alpine methods as well
- Allow for using EAV collection as provider

### [0.4.1] - 14 November 2025
#### Fixed
- Add FilterScope to every Filter
- Add component and scope args to FilterInterface::filter()
- Basic editor functionality
- Update composer keywords
- Update composer keywords
- Update composer keywords

_(Changelog truncated for .md surface. Full history on https://packagento.com/loki/magento2-admin-components.)_

## Recent Versions

| Version | Released |
|---|---|
| 0.6.4 | 2026-05-05 |
| 0.6.3 | 2026-05-01 |
| 0.6.2 | 2026-03-02 |
| 0.6.1 | 2026-02-20 |
| 0.6.0 | 2026-02-12 |
| 0.5.2 | 2026-01-28 |
| 0.5.1 | 2026-01-23 |
| 0.5.0 | 2026-01-21 |
| 0.4.4 | 2026-01-12 |
| 0.4.3 | 2025-12-30 |

Showing 10 of 40 versions. Full release history on https://packagento.com/loki/magento2-admin-components.

## Dependencies

### Require

| Package | Constraint |
|---|---|
| ext-json | * |
| loki/magento2-components | ^2.0 |
| loki/magento2-css-utils | ^1.0 |
| magento/framework | ^102.0 \| ^103.0 |
| magento/module-backend | ^101.0 \| ^102.0 |
| magento/module-catalog | ^102.0 \| ^103.0 \| ^104.0 |
| magento/module-customer | ^102.0 \| ^103.0 |
| magento/module-directory | ^100.0 |
| magento/module-eav | ^100.0 \| ^101.0 \| ^102.0 |
| magento/module-store | ^101.0 |
| magento/module-ui | ^101.0 |
| yireo/magento2-csp-utilities | ^1.0 |

## Quality

Latest release (0.6.4) fails 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 | Warning | 130 | 130 warnings (ruleset: Magento2) — 71 auto-fixable with phpcbf |
| PHPMD | Warning | 28 | 28 rule violations (UndefinedVariable:10, UnusedFormalParameter:6, EmptyCatchBlock:3, NPathComplexity:3, CyclomaticComplexity:2) |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |

#### 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 | 22 | 22 | – | – |
| 2.4.8 | – | 22 | 22 | – |
| 2.4.9 | – | – | 21 | 21 |


### 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=["loki/magento2-admin-components"],
  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

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

