Download the PHP package leeovery/laravel-playwright without Composer
On this page you can find all versions of the php package leeovery/laravel-playwright. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download leeovery/laravel-playwright
More information about leeovery/laravel-playwright
Files in leeovery/laravel-playwright
Package laravel-playwright
Short Description Backend stuff for Playwright e2e tests
License MIT
Homepage https://github.com/leeovery/laravel-playwright
Informations about the package laravel-playwright
Laravel Playwright
Backend utilities for Playwright e2e tests. Provides HTTP endpoints and commands to control your Laravel application during testing - manage databases, factories, authentication, migrations, and environment configuration from your Playwright tests.
Requirements
- PHP 8.3+
- Laravel 11+
Installation
Publish config and register service provider:
Configuration
The package config (config/playwright.php) includes:
- Environments: Control which environments expose the endpoints (default:
local,testing,playwright) - Route prefix: Customize the endpoint URL prefix (default:
__playwright__) - Middleware: Set middleware for routes (default:
web) - Environment files: Configure
.playwright.envfile handling - Factory settings: Map model aliases and configure factory behaviors
Create a .playwright.env file for test-specific environment variables.
Features
HTTP Endpoints
All endpoints are prefixed with __playwright__ (configurable) and protected by environment checks:
Database Management
POST /create-database- Create test databasePOST /drop-database- Drop test databasePOST /migrate- Run migrations (supports?fresh=1&seed=1)POST /truncate- Truncate specific tables
Factory & Authentication
POST /factory- Create model instances via factoriesPOST /login- Authenticate user (create or find existing)POST /logout- End sessionPOST /user- Get current authenticated user
Utilities
POST /artisan- Execute artisan commandsPOST /routes- Get application route listGET /csrf- Get CSRF tokenPOST /env-setup- Swap to.playwright.envPOST /env-teardown- Restore original.env
Artisan Commands
Usage Example
From Playwright tests, interact with Laravel via HTTP:
Factory State Parameters
Pass complex state parameters to factories:
Register param aliases in your service provider:
Security
Important: This package exposes powerful endpoints that can manipulate your application. Only enable in non-production environments. The package includes middleware that blocks requests outside configured environments.
If you discover security issues, email [email protected].
Testing
Development
Credits
- Lee Overy
- All Contributors
License
MIT License. See License File for details.
All versions of laravel-playwright with dependencies
illuminate/support Version ^11.0
spatie/laravel-package-tools Version ^1.14
ext-pdo Version *