Download the PHP package cyclechain/sandboxer without Composer
On this page you can find all versions of the php package cyclechain/sandboxer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cyclechain/sandboxer
More information about cyclechain/sandboxer
Files in cyclechain/sandboxer
Package sandboxer
Short Description Zero-modification Laravel sandbox package for complete data isolation in live demos and testing environments
License MIT
Homepage https://github.com/cyclechain/sandboxer
Informations about the package sandboxer
Sandboxer
A zero-modification Laravel package that provides complete data isolation for live product demos, SaaS playgrounds, interactive trial sessions, and testing environments—without altering a single line of your existing models, migrations, or database tables.
🎯 The Problem Sandboxer Solves
When offering live demos or trial sessions for your SaaS or web application, visitors often want to create, edit, or delete data (e.g., creating blog posts, adding products, modifying settings).
Traditionally, developers had to choose between:
- Resetting the database periodically: Interrupts active users and causes data collisions across simultaneous visitors.
- Modifying application logic & models: Polluting codebase with tenant checks, session filters, or custom traits.
- Spinning up isolated containers per user: Expensive, slow, and hard to manage at scale.
🚀 The Sandboxer Solution
Sandboxer intercepts Eloquent CRUD operations per user session transparently. Any data created, updated, or deleted by a demo visitor exists only in their isolated sandbox session.
- Master Database is 100% untouched: Production data remains safe and pristine.
- Zero Model Modifications: Works out-of-the-box without adding traits or modifying your Eloquent models or migrations.
- Multi-Visitor Isolation: Visitor A sees their sandboxed changes; Visitor B sees theirs—neither affects the master database or each other.
- Automatic Expiration & Cleanup: Sessions and sandboxed data expire automatically after a configured TTL.
📦 Installation
Install Sandboxer via Composer.
1. Production & Live Demo Installation
If you are deploying Sandboxer to provide live demo environments, interactive product tours, or sandbox mode in your production or staging SaaS application, install it as a main dependency:
2. Development & Testing Installation
If you are using Sandboxer strictly for local development isolation, testing, or preview environments, install it as a dev dependency:
⚙️ Setup & Migration
Publish the configuration file:
Run the package database migrations (creates sandbox_sessions and sandbox_storage tables):
🚀 Quick Start
Enable sandbox mode in your .env file:
That's it! Sandboxer automatically intercepts database operations whenever sandbox mode is activated.
🔍 Automatic Sandbox Activation
Sandboxer can automatically detect and activate sandbox mode for incoming HTTP requests based on:
- Subdomains:
demo.yourdomain.com,sandbox.yourdomain.com,try.yourdomain.com - URL Paths:
/demo,/sandbox,/try - Query Parameters:
?sandbox=1,?demo=true - Active Session Cookie:
sandbox_sessioncookie
Configure auto-detection in config/sandboxer.php:
📖 Usage
Sandbox Authentication Integration
For applications requiring demo user login, update your login controller (or custom auth handler) using SandboxAuthHelper:
Manual Sandbox Control
Use the Sandboxer Facade to check or control sandbox state manually:
🧹 Session Expiration & Automatic Cleanup
Sandbox sessions expire automatically based on the SANDBOXER_TTL setting (default: 3600 seconds / 1 hour).
To clean up expired sessions, schedule the SandboxCleanupJob in your app/Console/Kernel.php or routes/console.php:
Or dispatch manually:
🏗️ How It Works (Architecture)
- Write Interception: When a model is created, updated, or deleted,
ModelEventInterceptorcaptures the attributes, places the database connection in pretend mode (preventing actual SQL writes), and persists the mutation intosandbox_storage. - Read Interception: When Eloquent queries execute (
all(),where(),find()),SandboxScopeoverlays sandboxed insertions, updates, and deletions onto the retrieved master data.
⚙️ Configuration Reference
Edit config/sandboxer.php:
🧪 Testing
Run the PHPUnit test suite:
Or via Docker:
📄 License
The MIT License (MIT). Please see License File for more information.
👨💻 Credits
Developed and maintained by Fatih Mert Doğancan & CycleChain.
All versions of sandboxer with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/database Version ^9.0|^10.0|^11.0|^12.0
illuminate/http Version ^9.0|^10.0|^11.0|^12.0