PHPackages                             parisek/drupal-kit - 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. parisek/drupal-kit

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

parisek/drupal-kit
==================

Shared Drupal infrastructure for sites built on the PORTA component pattern: services, base classes, Twig extensions, image resizer.

v2.0.0(1mo ago)02GPL-2.0-or-laterPHPPHP &gt;=8.3CI passing

Since May 24Pushed 1mo agoCompare

[ Source](https://github.com/parisek/drupal-kit)[ Packagist](https://packagist.org/packages/parisek/drupal-kit)[ RSS](/packages/parisek-drupal-kit/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (7)Dependencies (20)Versions (9)Used By (0)

Drupal Kit
==========

[](#drupal-kit)

[![Packagist Version](https://camo.githubusercontent.com/4331c3f268b79d398fbe317386b1c91dddfc4a5f256315ff66f74037408de179/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7061726973656b2f64727570616c2d6b6974)](https://packagist.org/packages/parisek/drupal-kit)[![Packagist Downloads](https://camo.githubusercontent.com/af0eded1c5b4e270149247b2474dabc91747c538bee456ead5e718e7ec76beba/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7061726973656b2f64727570616c2d6b6974)](https://packagist.org/packages/parisek/drupal-kit/stats)[![CI](https://github.com/parisek/drupal-kit/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/parisek/drupal-kit/actions/workflows/ci.yml)[![Drupal](https://camo.githubusercontent.com/9e72d0b733dbfb3a817cfc98a0012dd70bdcb5c19a54853cd054fe40145b3701/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f44727570616c2d313025323025374325323031312d3036373842453f6c6f676f3d64727570616c266c6f676f436f6c6f723d7768697465)](https://www.drupal.org)[![PHPStan](https://camo.githubusercontent.com/019100119b760015cd9ea819f61553bfc0b922582404da2d091dd039284a70de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c253230382d326563633430)](https://phpstan.org/)[![Coverage](https://camo.githubusercontent.com/e62a8586752839a919c32a3684d47132ad698a46276aa216f8d4cbf230ebbc37/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d37382532352d326563633430)](.github/workflows/ci.yml)[![License: GPL-2.0-or-later](https://camo.githubusercontent.com/43a510dd0989747b1c3997cb691eaef0adc0f48c2ba392da31b012ef9030bf23/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d47504c2d2d322e302d2d6f722d2d6c617465722d626c75652e737667)](https://spdx.org/licenses/GPL-2.0-or-later.html)

`parisek/drupal-kit` — base library module for [Drupal](https://www.drupal.org) sites built on the **PORTA** component pattern. Provides shared infrastructure (services, base classes, [Twig](https://twig.symfony.com/) extensions, image resizer) reused across projects. The [Drupal](https://www.drupal.org) counterpart of [`parisek/timber-kit`](https://github.com/parisek/timber-kit) (WordPress).

Requires [PHP 8.3+](https://www.php.net/releases/8.3/) and [Drupal](https://www.drupal.org/about/10) 10 or 11.

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

[](#installation)

Published on [Packagist](https://packagist.org/packages/parisek/drupal-kit):

```
composer require parisek/drupal-kit
drush en drupal_kit
```

What this module provides
-------------------------

[](#what-this-module-provides)

**Services**

- `drupal_kit.entity_helper` — high-level entity loading and rendering helpers consumed by display plugins and Twig templates. Facade over the three builders below.
- `drupal_kit.media_array_builder` — builds the documented array shapes for Media and File entities (image, SVG, video, remote video, document, Lottie).
- `drupal_kit.menu_tree_builder` — renders a menu into the documented item shape (active trail, `field_*` enrichment, subtree scoping via `params['root']`).
- `drupal_kit.taxonomy_tree_builder` — builds nested taxonomy term trees.
- `Drupal\drupal_kit\Services\Resizer` — static utility: image style + focal point + responsive variant generator. Call `Resizer::resizer($images, $variants)` directly.
- `drupal_kit.menu_active_trail_resolver` — resolves the active menu trail accounting for entity references and aliases.
- `drupal_kit.twig_extension` — registers Twig functions used by component templates, including the typography-aware translation helpers `_xt` / `__t` / `_nt` / `_nxt` (translate, then pipe through `|typography`).
- `drupal_kit.typography_twig_extension` — provides the `|typography` Twig filter; delegates to [`parisek/twig-typography`](https://github.com/parisek/twig-typography) and resolves typography config from `{active_theme}/static/typography.yml`.
- `drupal_kit.route_subscriber` — alters routes for entity access edge cases.

**Base classes**

- `Drupal\drupal_kit\ComponentBase` — base for component [block plugins](https://www.drupal.org/docs/drupal-apis/block-api/block-api-overview).
- `Drupal\drupal_kit\DisplayBase` — base for [`extra_field`](https://www.drupal.org/project/extra_field) display plugins that render components.

**Filters**

`FilterImage`, `FilterLinks`, `FilterTable`, `FilterTypography`, `FilterYoutube` — [text format filters](https://www.drupal.org/docs/drupal-apis/filter-api/overview) that normalize editor output into PORTA's component shape.

Required modules
----------------

[](#required-modules)

Pulled automatically by Composer when you install:

- [`drupal/components`](https://www.drupal.org/project/components) — Twig component discovery (`@component/` namespace).
- [`drupal/config_pages`](https://www.drupal.org/project/config_pages) — single-instance config entities for site-wide content.
- [`drupal/extra_field`](https://www.drupal.org/project/extra_field) — extra field display plugins on entities.
- [`drupal/twig_real_content`](https://www.drupal.org/project/twig_real_content) — Twig filter to extract plain text from render arrays.
- [`drupal/twig_tweak`](https://www.drupal.org/project/twig_tweak) — collection of helpful Twig extensions.
- [`parisek/twig-typography`](https://github.com/parisek/twig-typography) — upstream typography filter (powers `|typography`).

Optional integrations
---------------------

[](#optional-integrations)

The following modules are optional. When present, `EntityHelper` automatically exposes additional fields and renderers; when absent, those code paths gracefully no-op.

Contrib (install via Composer):

- [`drupal/commerce`](https://www.drupal.org/project/commerce) — `commerce_product` entity support.
- [`drupal/office_hours`](https://www.drupal.org/project/office_hours) — `office_hours` field rendering.

Drupal core (enable via `drush en …`):

- [`comment`](https://www.drupal.org/docs/8/core/modules/comment) — comment entity support (`comment_body` field on Comment entities).

Drupal core patches (apply via [`cweagans/composer-patches`](https://github.com/cweagans/composer-patches)):

- [drupal.org#2466553](https://www.drupal.org/project/drupal/issues/2466553) — adds `menu.language_tree_manipulator` to Drupal core. When applied, `EntityHelper::getMenu()` filters menu links by the current content language. When absent, the filter step is silently skipped and menu items for all languages appear — on multilingual sites the status report (`/admin/reports/status`) shows a warning so the gap is visible.

Local development
-----------------

[](#local-development)

Local environment is [DDEV](https://ddev.com/) — pinned to PHP 8.3 in `.ddev/config.yaml` so it matches the production deploy target and CI. The database container is omitted; kernel tests use sqlite in-memory.

```
ddev start
ddev composer install
ddev exec scripts/dev-link-module.sh   # symlink module into web/modules/contrib + bridge web/autoload.php
ddev exec vendor/bin/phpunit
```

`scripts/dev-link-module.sh` resolves paths relative to where it runs, so it must be invoked inside the container — otherwise the symlinks point to host paths the container can't see.

### Tests

[](#tests)

Tests are self-contained — Composer scaffolds Drupal via [`installer-paths`](https://github.com/composer/installers); PHPUnit bootstraps from `web/core/tests/bootstrap.php`.

```
ddev exec vendor/bin/phpunit --testsuite unit
ddev exec vendor/bin/phpunit --testsuite kernel
```

### Coverage

[](#coverage)

`ddev coverage` is a custom command (defined in `.ddev/commands/web/coverage`) that runs PHPUnit with `xdebug.mode=coverage` and emits both clover XML and a textual summary:

```
ddev coverage
ddev coverage --filter ResizerTest   # any phpunit args pass through
```

CI uses the same flags so local + CI numbers stay aligned.

### Step-debugging

[](#step-debugging)

```
ddev xdebug on    # loads xdebug in debug mode; listen on host port 9003
ddev xdebug off   # debug mode is a heavy perf hit; keep it off by default
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for how to add tests and the unit-vs-kernel decision tree.

### Without DDEV

[](#without-ddev)

DDEV is the canonical local environment, but the repo doesn't hard-depend on it — CI runs vanilla `composer install` + `vendor/bin/phpunit` against PHP 8.3 from the [shivammathur/setup-php](https://github.com/shivammathur/setup-php) GitHub Action. If you prefer host-PHP, ensure you're on PHP 8.3 (matching CI / production) to avoid composer.lock drift.

Releasing
---------

[](#releasing)

Tag-driven; published on [Packagist](https://packagist.org/packages/parisek/drupal-kit), which syncs tags automatically via the GitHub webhook. Version bumps follow Conventional Commits, the public-API surface and deprecation lifecycle are defined in [RELEASING.md](RELEASING.md) — read it before tagging.

**Distribution scope:** `composer require` ships only the module files, `src/`, `templates/`, `composer.json`, `LICENSE` and `README.md` — everything development-only is `export-ignore`d in `.gitattributes`.

Related projects
----------------

[](#related-projects)

Part of the **PORTA** ecosystem:

- [`parisek/timber-kit`](https://github.com/parisek/timber-kit) — the WordPress counterpart: shared Timber/ACF infrastructure for PORTA themes.
- [`parisek/twig-typography`](https://github.com/parisek/twig-typography) — framework-agnostic typography Twig extension that powers our `|typography` filter.

License
-------

[](#license)

[GPL-2.0-or-later](https://spdx.org/licenses/GPL-2.0-or-later.html). See [`LICENSE`](LICENSE).

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance91

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.4% 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 ~6 days

Total

8

Last Release

49d ago

Major Versions

v1.6.0 → v2.0.02026-07-08

PHP version history (2 changes)v1.0.0PHP &gt;=8.1

v1.1.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f60a7484412a046d60bd8de9c5fb773cd9d59f00a1b455284fa718b786a4d93?d=identicon)[parisek](/maintainers/parisek)

---

Top Contributors

[![parisek](https://avatars.githubusercontent.com/u/10908003?v=4)](https://github.com/parisek "parisek (74 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

---

Tags

drupal-module

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/parisek-drupal-kit/health.svg)

```
[![Health](https://phpackages.com/badges/parisek-drupal-kit/health.svg)](https://phpackages.com/packages/parisek-drupal-kit)
```

###  Alternatives

[emulsify-ds/emulsify-drupal

The official Drupal theme for Emulsify, with Storybook and a Vite-based build workflow for generated child themes

96561.6k2](/packages/emulsify-ds-emulsify-drupal)[farmos/farmos

A web-based farm record keeping application.

1.3k7.3k1](/packages/farmos-farmos)[govcms/govcms

GovCMS Drupal Distribution

200103.6k3](/packages/govcms-govcms)[voidagency/vactory_starter_kit

Vactory is a custom Drupal profile which is developed and released by VOID Agency.

1022.3k](/packages/voidagency-vactory-starter-kit)

PHPackages © 2026

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