Download the PHP package zpmlabs/laravel-package-quick-demo without Composer
On this page you can find all versions of the php package zpmlabs/laravel-package-quick-demo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zpmlabs/laravel-package-quick-demo
More information about zpmlabs/laravel-package-quick-demo
Files in zpmlabs/laravel-package-quick-demo
Package laravel-package-quick-demo
Short Description Reusable quick demo installer for Laravel packages using isolated SQLite databases, routes, views, assets, storage, config publishing, and lifecycle hooks.
License MIT
Informations about the package laravel-package-quick-demo
Laravel Package Quick Demo
Reusable quick-demo installer for Laravel packages.
zpmlabs/laravel-package-quick-demo lets Laravel package authors ship isolated demo environments inside any host Laravel application.
It is built for packages that want a “try it now” experience without asking users to manually copy files, edit .env, create database connections, register routes, or pollute their main application database.
With this package, a user can install a package demo with one command:
Features
- Isolated SQLite database per demo.
- Runtime Laravel database connection per demo.
- Demo migrations.
- Demo seeders.
- Demo routes.
- Demo route prefixes and route name prefixes.
- Demo Blade view namespaces.
- Demo view publishing.
- Demo asset publishing.
- Demo storage file publishing.
- Demo config file publishing.
- Install hooks.
- Uninstall hooks.
- Safe uninstall command.
- Config-based and runtime-based demo registration.
Installation
Install the package:
Publish the config file if needed:
This publishes:
Configuration
Default config:
Most package authors do not need users to publish this config. Demos can be registered directly from a package service provider.
Basic usage in another package
Example package: vendor/blog-package.
Inside the package service provider:
Then the user runs:
Minimal database-only demo
A demo does not need routes, views, assets, storage, or config.
For a database-only demo, register only database, migrations, and seeders:
Install it:
This creates a separate SQLite database and runs only the configured migrations and seeders.
Full demo package structure
Recommended structure for a package that ships a complete mini demo app:
Commands
List all registered demos:
Show details for one demo:
Install a demo:
Reinstall a demo from scratch:
Reinstall from scratch and overwrite generated files:
Skip migrations:
Skip seeders:
Skip view publishing:
Skip asset publishing:
Skip storage publishing:
Skip config publishing:
Uninstall generated demo files:
Drop only the generated SQLite database:
Remove everything generated by the demo:
SQLite database isolation
Every registered demo gets its own SQLite database.
For example:
creates:
The package also registers a runtime Laravel connection:
Another package can register:
which creates:
and registers:
These databases are independent.
The package does not modify .env and does not require users to edit config/database.php.
SQLite stub files
Each demo can provide a SQLite stub file:
The stub may be:
- an empty SQLite file,
- a prebuilt SQLite database with schema,
- a prebuilt SQLite database with schema and demo data.
Recommended approach:
- keep the stub empty,
- create schema through migrations,
- create sample data through seeders.
Create an empty stub:
Demo migrations
Every demo migration should explicitly use the quick-demo connection.
examples/migrations/2026_01_01_000001_create_demo_posts_table.php
This prevents demo tables from being created in the host application's default database.
Demo seeders
Every demo seeder should write to the quick-demo connection.
src/Database/Seeders/BlogDemoSeeder.php
Demo models
Demo models should use the quick-demo connection.
src/Models/DemoPost.php
Demo routes
A package can provide routes for a demo UI.
examples/routes/demo.php
The package automatically mounts these routes under a safe prefix:
Route names are prefixed too:
This avoids collisions with the host application.
Demo controller
Example controller:
Demo views
A package can ship Blade views in:
Example:
Views are registered under a generated namespace:
Usage:
When installed, views are published to:
The published path is checked first. The package source path is used as fallback.
Demo assets
A package can ship demo assets in:
Example:
Assets are published to:
Usage in Blade:
Demo storage files
A package can ship sample storage files in:
Example:
Files are copied to:
Usage:
Demo config files
A package can ship a demo config file:
It is copied to:
The package does not modify existing application config files.
Config-based demo registration
Demos may also be registered through config/package-quick-demo.php.
Runtime registration from a package service provider is usually preferred.
Install and uninstall hooks
A demo can run custom logic before or after installation and uninstallation.
Hook classes should have a handle method:
The context contains useful information:
Hooks can also be closures or callable arrays.
Safe uninstall behavior
By default, uninstall does not remove everything automatically.
Use specific flags:
Remove everything:
Generated paths
For demo key:
and database name:
Generated paths are:
Generated route prefix:
Generated route name prefix:
Generated view namespace:
Generated connection:
Recommended naming
Good demo keys:
Avoid vague keys:
Good database names:
Good table names:
Avoid using real application table names for demo tables:
Safety rules
This package is designed to avoid polluting the host Laravel application.
It does not require users to:
- edit
.env, - edit
config/database.php, - edit
routes/web.php, - create a database connection manually,
- copy demo files manually.
Package authors should avoid:
- writing demo tables into the default database,
- registering unprefixed routes,
- using generic route names,
- publishing files directly into root public/resource/storage folders,
- overwriting files without
--force, - using generic demo keys.
Testing a demo locally
From a Laravel test application:
Open:
Validate:
Check that:
- the demo route is prefixed,
- the demo route names are prefixed,
- the SQLite database exists,
- migrations ran on the quick-demo connection,
- seeders inserted demo data,
- views render correctly,
- assets load correctly,
- storage files were copied if configured,
- config file was copied if configured,
- the host default database was not modified.
License
MIT
All versions of laravel-package-quick-demo with dependencies
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/filesystem Version ^11.0|^12.0|^13.0
illuminate/routing Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0