Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Drush Endpoint

No security coverage Under active development 1 sites

This module exposes Drush commands via a POST endpoint, allowing them to be triggered by automated testing tools like Cypress. It's designed for use cases where Drush cannot be run directly within the testing environment, such as when tests run in a separate container from the web server.

Exposes drush commands so that they can be called with POST.

To be used in automated testing (ie Cypress) when you can't run drush commands, for example when your testing suite runs on a different container than your web server.

Usage

In your Cypress test do a POST request:

cy.request({
  method: 'POST',  // Make sure this is POST
  url: '/api/drush/cron'
});


You can also use cURL from command line for testing:

curl -X POST https://SITENAME.ddev.site/api/drush/cron



Login to a site in a Cypress test

describe('I can login using Drush', () => {
  it('Logs me in', () => {
    // Login
    cy.request({
      method: 'POST',
      url: '/api/drush/uli',
    }).then((response) => {
      expect(response.status).to.eq(200);
      expect(response.body).to.have.property('success', true);

      const uli = response.body.output.trim();

      cy.visit(uli);
      // You are logged in!
    })
  })
})

Requirements

It is assumed that you have a complete understanding of what you are enabling on your site!

There are precautions that make it difficult to run this modules on production, but they will not save you if you intentionally enable it there. So be very careful.

Installation

  • Install as you would normally install a contributed Drupal module. See: https://www.drupal.org/node/895232 for further information.
  • There are no permissions, this is a module oriented to automated testing only. Everything is allowed by default.
  • Allow the module to run, by enabling it in your settings.local.php file:
    // Enable drush_endpoint
    $settings['drush_endpoint_enabled'] = TRUE;
    $settings['drush_endpoint_allow_uli'] = TRUE;
    

NOTE

As you see above, uli commands need that extra line to be enabled.

WARNING

Do not put the above lines in production!

Maintainers

Ask your assistant about Drush Endpoint

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
2
Tracked since
Jan 2025
Latest release
4 months ago
Releases (12 mo)
1
Maintenance
Active

Releases

Version Type Core PHP Release date
1.0.0-rc1 Pre-release 10–11 Jun 13, 2026
1.0.x-dev Dev 10–11 Jan 22, 2025