h2022 / laravel-opcache
PHP OPcache Artisan 命令用于 Laravel。
4.0.3
2022-06-25 09:33 UTC
Requires
- php: >=7.2.5
- guzzlehttp/guzzle: ^6.3.1|^7.0
- laravel/framework: >=7.0
Requires (Dev)
- orchestra/testbench: ^5.0
- phpunit/phpunit: ^8.5
This package is auto-updated.
Last update: 2024-09-25 16:57:40 UTC
README
本包包含一些用于操作 PHP OPcache 的有用 Artisan 命令。
如果您想了解更多关于 OPcache 及其在 Laravel 应用程序中的作用,请阅读 Medium 上的文章让你的 Laravel 应用飞起来 —— PHP OPcache。
要求
本包需要 Laravel 7 或更高版本。
安装
您可以通过 Composer 安装本包
composer require h2022/laravel-opcache
如果您需要更改配置值,可以使用以下命令发布配置文件
php artisan vendor:publish --provider="Appstract\Opcache\OpcacheServiceProvider" --tag="config"
请确保在 .env 中正确设置了 APP_URL。
如果您想设置不同的 URL 来调用 OPcache 路由(例如用于负载均衡器),可以设置 OPCACHE_URL。
用法
清除 OPcache
php artisan opcache:clear
显示 OPcache 配置
php artisan opcache:config
显示 OPcache 状态
php artisan opcache:status
预编译您的应用程序代码
php artisan opcache:compile {--force}
注意:必须启用 opcache.dups_fix 或使用 --force 标志。如果您遇到 "Cannot redeclare class" 错误,请启用 opcache.dups_fix 或将类路径添加到排除列表中。
程序化使用
use Appstract\Opcache\OpcacheFacade as OPcache; ... OPcache::clear();
贡献
欢迎贡献,感谢大家的贡献 :)
关于 Appstract
Appstract 是来自荷兰的一个小型团队。我们为 Web 开发创建(开源)工具。
许可证
MIT 许可证(MIT)。请参阅许可证文件获取更多信息。