saturio / opcache-manager
Reset cache, show summary information and get configuration about de OPcache
Installs: 78
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.4
- ext-ctype: *
- ext-iconv: *
- ext-json: *
- ext-zend-opcache: *
- symfony/browser-kit: ^4.4|^5.0
- symfony/console: ^4.4|^5.0
- symfony/dotenv: ^4.4|^5.0
- symfony/flex: ^1.3.1
- symfony/framework-bundle: ^4.4|^5.0
- symfony/http-client: ^4.4|^5.0
- symfony/yaml: ^4.4|^5.0
Requires (Dev)
- symfony/debug-bundle: ^4.4|^5.0
- symfony/phpunit-bridge: ^4.4|^5.0
This package is auto-updated.
Last update: 2024-09-29 05:49:07 UTC
README
Manage your OPcache using CLI through API endpoints.
The OpcacheManagerBundle a simple and fast way to manage your cache using CLI commands and the most useful package for your CI/CD scripts.
How it works
The issue
OPcache doesn't provide any method to clean your
application cache using a CLI. So, if you want to clean your symfony app cache, you must run
opcache_reset()
function in your web server or your php-fpm process. That is mean that
you need a URL in your app that call the reset function.
Of course, you could use something like php7.4-fpm reload
to refresh OPCache if the user you use
for deployment has permissions.
This is a headache when we use CI/CD tools for the deployment, since we can't reset the cache launching a command.
OpcacheManagerBundle solution
OpcacheManagerBundle provides some routes to manage your OPCache through symfony commands.
These commands make signed requests to the routes and show results in console. For security reasons,
the request must to be signed (the bundle manage this by itself), so it can't be use directly unless
the APP_SECRET
is known.
Instalation
composer require saturio/opcache-manager
Configuration
First of all, active the bundle in your config/bundles.php
file:
// config/bundles.php <?php return [ // ... Saturio\OpcacheManagerBundle\SaturioOpcacheManagerBundle::class => ['all' => true], ];
Add the OpcacheManager routes:
# config/routes/opcache_manager.yml saturio_opcache: resource: "@SaturioOpcacheManagerBundle/Resources/config/routing.yaml"
And, finally, configure the OpcacheManager:
# config/packages/saturio_opcache_manager.yaml saturio_opcache_manager: server: default_uri: 'http://127.0.0.1:8000' # Your base URL
Usage
👉 Note that you must have a server running your app to use OPCacheManagerBundle.
Use these simple commands:
bin/console saturio:opcache:reset bin/console saturio:opcache:status bin/console saturio:opcache:configuration
Testing
Clone de repo and run:
composer install bin/phpunit
Made with ❤️ and without 👮 in Soria.