- What does vormkracht10/laravel-static do?
- It is a Laravel package that generates static HTML versions of your routes and serves them as flat files from a local disk. Each URI, including its query string, maps to one cache file, which can reduce server load and speed up responses. Your existing Laravel routing and Blade views remain in place; the package caches the rendered output rather than replacing your application.
- How do I install laravel-static in a Laravel app?
- Install it with Composer and rely on Laravel package auto-discovery, then publish the package config. You need a writable local filesystem with enough inode headroom and web-server rewrite rules such as nginx try_files or Apache equivalents so static files are served before Laravel. No migrations are required.
- Which Laravel and PHP versions does laravel-static support?
- The package is pre-1.0, so confirm the Laravel and PHP constraints in its composer.json before committing. The evaluation notes explicitly recommend verifying the supported Laravel/PHP matrix against the Composer constraints. Do not assume compatibility with a given Laravel release without checking.
- How does laravel-static handle query strings in cached URLs?
- It writes one static file per URI, and the query string is part of that URI, so ?page=2 and ?sort=price create separate cache files. That preserves distinct pages but causes file proliferation for high-cardinality query parameters. Version 0.11.0's static:status command reports storage split between query-string and non-query-string URLs and shows the most common query parameters.
- How do I clear the static cache?
- Use the static:clear Artisan command, which is the only removal mechanism described. The --only-with-query-strings option is a blunt, content-blind prune: it cannot tell a utm_source campaign link from ?page=2, ?sort=price, or ?filter=red. Clearing all query-string variants can therefore leave stale or wrong content or produce 404s for legitimately distinct pages.
- Can laravel-static store static files on S3 or a remote disk?
- No. The package writes to a local disk; remote or ephemeral storage such as S3, network mounts, or container scratch volumes is out of scope. On those deployments static:status will report empty or misleading numbers. For multi-node fleets, run static:status per node or against a shared volume using --disk=, remembering that results are per-disk, not per-cluster.
- What does php artisan static:status report?
- static:status is a read-only observability command added in v0.11.0. It reports storage split by query-string vs non-query-string URLs, directory rollups, top URLs by variant count, most common query parameters, per-host and per-file-type breakdowns, age distribution, largest files, and the governing config settings. --disk=, --limit=, and --json make it scriptable, but the JSON schema is not yet a stable contract.
- Can I use laravel-static for logged-in users or personalized pages?
- No. The package fits anonymous, highly cacheable, content-driven workloads such as marketing sites, documentation, blogs, and landing pages. It does not fit authenticated, personalized, or high-cardinality-query applications, where per-URI file proliferation is guaranteed.
- How is laravel-static different from a Redis-backed full-page cache?
- It is not a drop-in replacement for Redis- or Memcached-backed full-page cache packages because it writes flat files, so invalidation cannot be done with Cache::forget(). Teams migrating from a store-backed cache must rebuild their invalidation strategy around static:clear, which only supports coarse-grained clearing. It is additive if your app currently has no full-page cache or uses a CDN-only strategy.
- Is laravel-static production-ready and is the --json output stable?
- Treat it as pre-1.0: command semantics and the --json schema may change between minor releases, so consider the JSON output an unstable monitoring contract until 1.0. Growth is architectural rather than incidental, since nothing is removed except by a full static:clear, and v0.11.0 makes that growth visible without bounding it. Also verify the measured traversal cost for very large caches, because the release notes give no wall-clock or IOPS figures for million-file caches.