drupal-state

Installation
SKILL.md

Drupal State API

State is for runtime data that should persist across requests but is NOT configuration. Use Config for user-managed settings. Use State for internal operational data (last cron run, migration status, etc.).

Basic Usage

use Drupal\Core\State\StateInterface;

// Inject
public function __construct(
  private readonly StateInterface $state,
) {}

// Get
$value = $this->state->get('my_module.last_run');
$value = $this->state->get('my_module.last_run', $default_value);
Installs
29
GitHub Stars
71
First Seen
Apr 17, 2026
drupal-state — edutrul/drupal-ai