appstract / laravel-opcache
Laravel 的 PHP OPcache Artisan 命令。
4.0.2
2020-12-01 16:12 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-08-29 04:40:20 UTC
README
此包包含一些用于与 PHP OPcache 一起使用的实用 Artisan 命令。
如果您想了解更多关于 OPcache 以及它能为您的 Laravel 应用程序做什么的信息,请阅读 Medium 上的文章让您的 Laravel 应用程序飞起来——使用 PHP OPcache。
要求
此包需要 Laravel 7 或更高版本。
安装
您可以通过 Composer 安装此包
composer require appstract/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)。请参阅许可文件以获取更多信息。