drush

my_module.services.yml
tags:
  - { name: cache_prewarmable }

MyPlugin.php
/**
  * Implements \Drupal\Core\PreWarm\PreWarmableInterface.
  */
public function preWarm(): void {
  $this->getDefinitions();
}

get_one_time_login_for_domains.sh
drush uli

https://my-project.dev.erd.fish/user/reset/1/1743658959/GxIzcvUB-Hv7E9WPoxyAIF-_pXD4kTH3GCIXQ2QFZz0/login

get_environment_one_time_login.txt
copy:
/user/reset/1/1743658959/GxIzcvUB-Hv7E9WPoxyAIF-_pXD4kTH3GCIXQ2QFZz0/login

look up your site domains in the .ddev/.ddev-docker-compose-base.yaml:

external_links:
    - "ddev-router:cms.ddev.site"

Add everything after '/' from the drush uli command.

cms.ddev.site/user/reset/1/1743659359/GxIzcvUB-Hv7E9WPoxyAIF-_pXD4kTH3GCIXQ2QFZz0/login
HelloWorldCommands.php
<?php

declare(strict_types=1);

namespace Drupal\nice_module\Drush\Commands;

use Drupal\Component\DependencyInjection\ContainerInterface;
use Drupal\nice_module\HelloWorldService;
use Drush\Attributes as CLI;
use Drush\Commands\DrushCommands;

/**
 * A Drush command class for saying "hello" to the world.
 */
final class HelloWorldCommands extends DrushCommands {

  public function __construct(
    private readonly HelloWorldService $helloWorldService,
  ) {
    parent::__construct();
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container): self {
    return new static($container->get('nice_module.hello_world_service'));
  }

  #[CLI\Command(name: 'nice_module:say-hello', aliases: ['smci'])]
  #[CLI\Argument(name: 'userName', description: 'The name of the user.')]
  public function sayHello(?string $userName = NULL): void {
    $this->helloWorldService->sayHello($userName, $this->output());
    $this->logger()->success('I said "hello" to the user.');
  }

}

First, you could check if there are different states of your config between database and local file system.

drush_config_status.sh
drush config:status

There is an option `--diff` for the drush command that will print the changes first.

drush_config_import_diff.sh
drush config:import --diff

This also works for config export.

drush_config_export_diff.sh
drush config:export --diff
drush_migrate_status.sh
drush migrate:status

Display a summary of the status of your migrations.

drush_migrate_import.sh
drush migrate:import

Trigger the import process for migrations.

drush_migrate_reset_status.sh
drush migrate:reset-status

Reset the migration statuses if your migration get stuck.

drush_migrate_rollback.sh
drush migrate:rollback

Rollback your migrations by undoing changes made.

drush_migrate_stop.sh
drush migrate:stop

 Stop a running migration gracefully.

drush_migrate_field_source.sh
drush migrate:fields-source

List field sources of your sources plugin.

drush_migrate_message.sh
drush migrate:messages

Show migration messages.

17.05.2024 | Michael Ebert

Drush Migrate Commands

drushCommand_php_cli.sh
drush php:cli

drushCommand_php_eval.sh
drush php:eval

drushCommand_php_script.sh
drush php:script

14.04.2026 | Michael Ebert, Lothar Ferreira Neumann

drush php commands

clear_cache.php
<?php

apcu_clear_cache();
opcache_reset();
13.11.2025 | Nikolas Kopp

Clear APC & Opcache