laranail/demo-mode
Composer 安装命令:
composer require laranail/demo-mode
包简介
Comprehensive, granular, license-aware demo/sandbox controller for Laravel products — read-only & write guards, per-model/route/feature gating, reset/restore strategies, per-visitor sandboxing, demo accounts and banner. Complements laranail/license-verifier without re-implementing it. CLI/TUI-first.
README 文档
README
A granular, license-aware demo / sandbox controller for Laravel products — block writes, gate features, reset data periodically, isolate visitors, auto-login, and show a banner, all configurable with sensible defaults.
Requires PHP ^8.4 || ^8.5 on Laravel ^13. Complements laranail/license-verifier (a trial app can drop into demo mode automatically) but works standalone with no hard dependency.
Install
composer require laranail/demo-mode
php artisan vendor:publish --tag="demo-mode-config"
The service provider and the Demo facade are auto-discovered.
Quick start
Turn demo mode on (or drive it from the license):
DEMO_MODE_ENABLED=true # manual toggle # DEMO_MODE_TRIGGER=license # or: demo when the license is not usable
Block writes on your routes and models, and gate a feature:
Route::middleware('demo.readonly')->group(/* writes blocked in demo */); Route::post('export', ...)->middleware('demo.feature:export');
use Simtabi\Laranail\Demo\Mode\Concerns\PreventsDemoWrites; class Setting extends Model { use PreventsDemoWrites; // all writes blocked in demo }
@demo <span class="badge">Demo</span> @enddemo
See Getting started for every surface — facade, middleware, controllers, models, Blade, and events.
What it controls
| Concern | Mechanism | Docs |
|---|---|---|
| Activation | manual / license / both / environment / schedule triggers, plus bypass by role/ability/id/IP/gate |
Configuration · License integration |
| Write protection | layered: HTTP middleware + Eloquent guard + strict/read-only connection | Write guards |
| Feature gating | named features, entitlement-aware (paying customers keep full functionality) | Getting started |
| Reset & restore | pluggable strategies (migrate-fresh-seed, snapshot, SQL dump, callback), scheduled or on demand |
Reset & restore |
| Visitor isolation | shared / transactional / scoped / tenant sandboxes |
Per-visitor sandbox |
| Demo UX & safety | banner, demo accounts / auto-login, side effects to safe sinks (mail → log) | Configuration · Security |
Documentation
Full documentation is at opensource.simtabi.com/documentation/laranail/demo-mode — getting started, activation triggers, write protection, per-model/route/feature gating, reset strategies, per-visitor sandboxing, middleware, the Artisan commands, and configuration.
Guides
- Installation — requirements, publishing, optional dependencies, scheduling.
- Getting started — facade, middleware, controllers, models, Blade, events.
- Configuration — every section of
config/demo-mode.php. - Architecture — components, activation/request/reset flows, prior art.
- License integration — driving demo mode from the license state.
- Security & threat model — what the guards do and do not protect against.
- Release — versioning and how releases are cut.
Reference
- Commands —
laranail::demo-mode.*and thedemo:*aliases. - Write guards — the layered write-protection model and strategies.
- Reset & restore — strategies, scope, safety, triggers.
- Per-visitor sandbox — shared, transactional, scoped, and tenant isolation.
Stability
Semver. The package is on the 0.x line — minor versions may contain breaking changes until 1.0;
pin to a patch range and read the CHANGELOG and UPGRADE guide before
upgrading.
Local development
composer install composer test # pest composer lint # pint + phpstan + rector --dry-run
Sister packages
The laranail licensing family:
| Package | What it is |
|---|---|
laranail/license-kit |
Server-side licensing — activation keys, polymorphic assignment, expirations/renewals, seat control. |
laranail/license-verifier |
Headless, provider-agnostic verification client — PASETO/Ed25519 offline verification, fingerprinting, seats, grace periods. |
laranail/license-verifier-ui |
UI engine for the verifier — scaffolds owned, themeable preset packages (Blade, Livewire, Filament, Vue). |
laranail/product-updater |
License-gated self-update engine — checks a source, verifies archives, applies releases safely. |
Community
Questions, bug reports, and ideas go to GitHub Issues.
Contributing & security
Issues and PRs are welcome — see CONTRIBUTING.md. Report vulnerabilities per SECURITY.md (opensource@simtabi.com); participation follows the Code of Conduct.
License
MIT © Simtabi LLC. See LICENSE.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-09