aculix99/laravel-quick-static
Composer 安装命令:
composer require aculix99/laravel-quick-static
包简介
Serve static html, json and xml files without booting laravel for best performance
README 文档
README
Introduction
This package allows you to serve static html, json and xml files without booting laravel for best performance! It's inspired by page-cache.
Installation
Install with Composer
composer require aculix99/laravel-quick-static
.gitingore
- Add the cache folder name (default =
_quick-static) to your.gitingoreto avoid cached files in your vcs
URL Rewriting
Snippet
Add these lines to the public/index.php of your laravel application right after the use statements:
define('QUICK_STATIC_ROOT', __DIR__); require __DIR__ . '/../vendor/aculix99/laravel-quick-static/loader.php';
Full file as reference
Your full index.php will then look like this:
<?php use Illuminate\Foundation\Application; use Illuminate\Http\Request; define('QUICK_STATIC_ROOT', __DIR__); require __DIR__ . '/../vendor/aculix99/laravel-quick-static/loader.php'; define('LARAVEL_START', microtime(true)); // Determine if the application is in maintenance mode... if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) { require $maintenance; } // Register the Composer autoloader... require __DIR__.'/../vendor/autoload.php'; // Bootstrap Laravel and handle the request... /** @var Application $app */ $app = require_once __DIR__.'/../bootstrap/app.php'; $app->handleRequest(Request::capture());
Configuration
Publish config file
php artisan vendor:publish --tag=quick-static
Cache config file
- The config file needs to be cached so that the loader.php can read it without booting laravel.
- Run the following command to generate
bootstrap/cache/quick-static.php
php artisan quick-static:cache-config
Composer
- Add these two commands to your
post-autoload-dump-script
"post-autoload-dump": [ // "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", // "@php artisan package:discover --ansi", "@php artisan vendor:publish --tag=quick-static", "@php artisan quick-static:cache-config" ],
Customizations
Feel free to use and adjust the loader within your index.php the way you like it. Since it's PHP rewriting, you can do your very own, performant PHP MAGIC. Also you can ignore cached files if query parameters are present.
Usage
Using the middleware
Just add the middleware to the corresponding routes like this:
... Route::middleware(\Aculix99\LaravelQuickStatic\Middleware\StoreStatic::class)->group(function() { Route::get('/path', fn() => view('test')); Route::get('/json', fn() => response()->json('test')); }); ...
Clearing the cache
php artisan quick-static:clear
Optimization
- The quick-static compiled config cache file will be automatically created and deleted when
php artisan optimizeandphp artisan optimize:cleargets utilized. - Furthermore the config file will be cached when the composer script
post-autoload-dumpruns, so after everycomposer dump-autoloadcomposer installcomposer update
- Also you can manually create and delete the compiled config file:
php artisan quick-static:cache-configphp artisan quick-static:clear-cached-config
License
This package is open-sourced software licensed under the MIT license.
aculix99/laravel-quick-static 适用场景与选型建议
aculix99/laravel-quick-static 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 10 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「json」 「xml」 「html」 「static」 「caching」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 aculix99/laravel-quick-static 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aculix99/laravel-quick-static 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 aculix99/laravel-quick-static 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
Kinikit - PHP Application development framework MVC component
ext-json wrapper with sane defaults
A package to cast json fields, each sub-keys is castable
Load DOM document safety
HTML and form generation
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-09