Pinto allows you to define frontend components using plain PHP classes, simplifying the creation and management of reusable UI elements within Drupal. It integrates smoothly with various Drupal systems like controllers, blocks, and layouts, offering a YAML-free alternative to other component management solutions. Pinto also provides helpers for organizing component files, including PHP, Twig, CSS, and JavaScript.
Pinto is a way of defining frontend components with plain PHP. Define components as simple classes, and let Pinto do the rest. Works well with controller/render-arrays, blocks, layouts, entity displays, etc. No fussing with YAML. Some say its a nicer alternative to SDC. Helpers are provided to replicate a "single directory" setup, wherein PHP, Twig, CSS, JS are colocated.
Example
Component class
namespace Drupal\my_site_ds;
class MyComponent {
use Drupal\pinto\Object\DrupalInvokableSlotsTrait;
public function __construct(
public string $str,
public int $number,
) {
}
}
Template
{{ str }}
{{ number }}
Usage
(new MyComponent(
str: 'Hello world',
number: 123,
))();
Project
Pinto has adopted zerover. To inspire confidence, you'll find both the Drupal Pinto project and Pinto PHP library have great test coverage, code coverage, and [level 9 PHPStan] static analysis.
Development of core Pinto features happen on GitHub, while the Drupal integration happens on Drupal.org. Each of these projects are completely independent, while the Drupal integration has a dependency on the library.
See also:
- https://www.drupal.org/project/pinto_block
- https://www.drupal.org/project/pinto_entity
- https://www.drupal.org/project/pinto_layout
- https://www.drupal.org/project/pinto_theme
Documentation
Official documentation is available at https://pinto.docs.contrib.social/
Read the blog posts on Pinto:
- Next level theming with Pinto by @acbramley on PreviousNext
- Entity theming with Pinto by @acbramley on PreviousNext
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
3 tracked projects depend on this one
- Pinto Entity 3 sites
- Pinto Theme 3 sites
- Pinto Layout 3 sites
Activity
Release Timeline
Releases
| Version | Type | Core | Notes | Release date | |
|---|---|---|---|---|---|
| 0.7.0-beta6 | Pre-release | 10–11 | Remove realpath: canonicalize without solving symlinks | Dec 22, 2025 | |
| 0.7.0-beta5 | Pre-release | 10–11 | Use the symlink path rather than resolved and optimised paths from reflection | Dec 21, 2025 | |
| 0.7.0-beta4 | Pre-release | 10–11 | Retain and merge render array values | Dec 20, 2025 | |
| 0.7.0-beta3 | Pre-release | 10–11 | Add an interface for Build Registry. | Dec 19, 2025 | |
| 0.7.0-beta2 | Pre-release | 7–11 | Render element, fix namespace bug, move hook theme and library concepts into Drupal module. | Dec 17, 2025 | |
| 0.7.0-beta1 | Pre-release | 10–11 | Standalone Pinto components | Dec 11, 2025 | |
| 0.6.0 | Stable | 10–11 | Provide a simplified and opinionated object trait | Nov 6, 2025 | |
| 0.5.2 | Stable | 10–11 | Minor bug fix for external assets with URLs beginning with `//` | Aug 7, 2025 | |
| 0.5.1 | Stable | 10–11 | CI and core workarounds for using PHP 8.1's "new in initialisers" in Pinto objects. | May 4, 2025 | |
| 0.5.0 | Stable | 10–11 | Support adding slots to parent objects, depend on parent object assets. | Apr 20, 2025 | |
| 0.4.3 | Stable | 10–11 | 🐛 Fix `dependencies` being wiped from library definitions | Apr 14, 2025 | |
| 0.4.2 | Stable | 10–11 | 💚 Force container cache clears | Apr 9, 2025 | |
| 0.3.2 | Stable | 10–11 | 💚 Force container cache clears | Apr 9, 2025 | |
| 0.4.1 | Stable | 10–11 | 🐛 Fix assets provided by stream wrappers having characters removed. | Apr 7, 2025 | |
| 0.4.0 | Stable | 10–11 | ✨ Add support for Asset globs: May be back-compat breaking, check your ObjectListInterface::cssDirectory & ObjectListInterface::jsDirectory and ensure they're returning absolute directories. You should be seeing exceptions if there are problems. | Apr 5, 2025 | |
| 0.3.1 | Stable | 10–11 | Add stream wrapper to serve CSS and JS assets from arbitrary locations | Apr 4, 2025 | |
| 0.3.0 | Stable | 10–11 | Object type inheritance, Slot rename registry, Canonical Product Factory, Auto-invoke nested objects, list registration via parameter. | Apr 1, 2025 | |
| 0.2.2 | Stable | 10–11 | Move safe lib to dev- dependencies. | Jan 31, 2025 | |
| 0.2.1 | Stable | 10–11 | ✨ Bind slots values from promoted property slots | Nov 8, 2024 | |
| 0.2.0 | Stable | 10–11 | ✨ Slots and object types | Oct 24, 2024 | |
| 0.1.1 | Stable | 10–11 | Oct 23, 2024 |