PHPackages                             forme/crosswise - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. forme/crosswise

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

forme/crosswise
===============

v1.0.0(3y ago)02.2kMITPHP

Since Jan 16Pushed 1y ago1 watchersCompare

[ Source](https://github.com/formewp/forme-crosswise)[ Packagist](https://packagist.org/packages/forme/crosswise)[ RSS](/packages/forme-crosswise/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependencies (5)Versions (3)Used By (0)

Forme Crosswise
===============

[](#forme-crosswise)

Adds End To End helper routes to a [Forme Framework](https://github.com/formewp/forme-framework) project.

Overview
--------

[](#overview)

Crosswise provides a set of protected endpoints that are only available in testing environments. These endpoints help facilitate common testing operations like user creation, database migrations, and running arbitrary PHP code from your front end during end to end tests.

Crosswise is inspired by and derived from [laracasts/cypress](https://github.com/laracasts/cypress).

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

[](#installation)

```
composer require forme/crosswise --dev
```

Available Endpoints
-------------------

[](#available-endpoints)

All endpoints are prefixed with `/__e2e__` and are only accessible when `WP_ENV=testing`.

### Create (`POST /__e2e__/create`)

[](#create-post-__e2e__create)

Creates a new model instance with the given attributes.

```
{
    "model": "App\\Models\\Post",
    "attributes": {
        "title": "Test Post",
        "content": "Test Content"
    }
}
```

### Login (`POST /__e2e__/login`)

[](#login-post-__e2e__login)

Creates and/or logs in a user. Returns the user object.

```
{
    "id": 1,              // optional - specific user ID
    "role": "subscriber"  // optional - defaults to "subscriber"
}
```

### Current User (`GET /__e2e__/current-user`)

[](#current-user-get-__e2e__current-user)

Returns the currently logged-in user.

### Migrate (`GET /__e2e__/migrate`)

[](#migrate-get-__e2e__migrate)

Runs all pending database migrations.

### Rollback (`GET /__e2e__/rollback`)

[](#rollback-get-__e2e__rollback)

Rolls back all database migrations.

### Run PHP (`POST /__e2e__/run-php`)

[](#run-php-post-__e2e__run-php)

Executes arbitrary PHP code and returns the result.

```
{
    "command": "App\\Models\\Post::count()"
}
```

Security
--------

[](#security)

All endpoints are protected by Forme's `TestOnlyMiddleware` which ensures they can only be accessed when `WP_ENV=testing`. The Rollback endpoint has an additional redundant check to make double sure of this.

It goes without saying that you should *never* install or enable Crosswise in production environments.

Usage Examples
--------------

[](#usage-examples)

```
// basic usage
await axios.post('/__e2e__/login', {
    role: 'administrator'
});

await axios.post('/__e2e__/create', {
    model: 'App\\Models\\Post',
    attributes: {
        title: 'Test Post',
        status: 'publish'
    }
});
```

```
// Cypress command example
/**
 * create a model instance
 *
 * @example cy.create('App\\Models\\Post', { title: 'Test Post', status: 'publish'});
 */
Cypress.Commands.add('create', (model: string, attributes: { [key: string]: any } = {}) => {
    let requestBody = { model, attributes };
    return cy.request({
        method: 'POST',
        url: '/__e2e__/create',
        body: { ...requestBody },
        log: false,
    }).
        then(({ body }) => {
            Cypress.log({
                name: 'create',
                message: model + ' created successfully',
                consoleProps: () => ({ result: body }),
            });
        }).
        its('body', { log: false });
});

// then use it in your tests
cy.create('App\\Models\\Post', { title: 'Test Post', status: 'publish' });
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

```

```

###  Health Score

27

—

LowBetter than 46% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~56 days

Total

2

Last Release

1252d ago

Major Versions

v0.1.0 → v1.0.02023-03-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/ee574cb4adefd185b5e783e3208afd3d4d27187c8eb1e6f14f627428499cc715?d=identicon)[moussaclarke](/maintainers/moussaclarke)

---

Top Contributors

[![moussaclarke](https://avatars.githubusercontent.com/u/13017858?v=4)](https://github.com/moussaclarke "moussaclarke (5 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/forme-crosswise/health.svg)

```
[![Health](https://phpackages.com/badges/forme-crosswise/health.svg)](https://phpackages.com/packages/forme-crosswise)
```

###  Alternatives

[toplan/laravel-sms

A mobile phone number validation solution based on laravel

83580.2k2](/packages/toplan-laravel-sms)[drupal/coder

Coder is a library to review Drupal code.

3046.8M629](/packages/drupal-coder)[hyperf/validation

hyperf validation

122.2M213](/packages/hyperf-validation)[udokmeci/yii2-phone-validator

Modern Yii2 Phone validator wrapper on top of PhoneNumberUtil library also used by Android devices

36227.5k1](/packages/udokmeci-yii2-phone-validator)[snowcap/vat-validation

EU VAT number validation

10112.3k](/packages/snowcap-vat-validation)

PHPackages © 2026

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