PHPackages                             sixdays/opcache-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. sixdays/opcache-bundle

ActiveSymfony-bundle[CLI &amp; Console](/categories/cli)

sixdays/opcache-bundle
======================

Provides a command line task to clear opcache cache from the console

v1.0.1(8y ago)3061.3k↓93.3%8[1 issues](https://github.com/sixdayz/OpcacheBundle/issues)MITPHPPHP &gt;=5.4.0

Since Jun 9Pushed 6y ago1 watchersCompare

[ Source](https://github.com/sixdayz/OpcacheBundle)[ Packagist](https://packagist.org/packages/sixdays/opcache-bundle)[ Docs](https://github.com/sixdayz/OpcacheBundle)[ RSS](/packages/sixdays-opcache-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (3)Used By (0)

Provide a command line to clear opcache cache from the console.

The problem with opcache is that it's impossible to clear it from command line. Because even if you enable opcache for PHP CLI, it's a different instance than, say, your Apache PHP or PHP-CGI opcache instance.

The trick here is to create a file in the web dir, execute it through HTTP, then remove it.

Installation
============

[](#installation)

1. Add it to your composer.json:

    ```
    {
        "require": {
            "sixdays/opcache-bundle": "dev-master"
        }
    }
    ```

    or:

    ```
        composer require sixdays/opcache-bundle
        composer update sixdays/opcache-bundle
    ```
2. Add this bundle to your application kernel:

    ```
     // app/AppKernel.php
     public function registerBundles()
     {
         return array(
             // ...
             new Sixdays\OpcacheBundle\SixdaysOpcacheBundle(),
             // ...
         );
     }

    ```
3. Configure `sixdays_opcache` service:

    ```
     # app/config/config.yml
     sixdays_opcache:
         base_url:   http://localhost/ #could also be https://, or http://127.0.0.1:8000/, or any other valid URL
         web_dir:    %kernel.root_dir%/../web

    ```

Usage
=====

[](#usage)

Clear all opcache cache:

```
      $ php app/console opcache:clear

```

Capifony usage
==============

[](#capifony-usage)

To automatically clear opcache cache after each capifony deploy you can define a custom task

```
namespace :symfony do
  desc "Clear opcache cache"
  task :clear_opcache do
    capifony_pretty_print "--> Clear opcache cache"
    run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} #{symfony_console} opcache:clear --env=#{symfony_env_prod}'"
    capifony_puts_ok
  end
end
```

and add this hook

```
# opcache
after "deploy", "symfony:clear_opcache"
```

Nginx configuration
===================

[](#nginx-configuration)

If you are using nginx and limiting PHP scripts that you are passing to fpm you need to allow 'opcache' prefixed php files. Otherwise your web server will return the requested PHP file as text and the system won't be able to clear the opcache cache.

Example configuration:

```
# Your virtual host
server {
  ...
  location ~ ^/(app|app_dev|opcache-.*)\.php(/|$) { { # This will allow opcache (opcache-{MD5HASH}.php) files to be processed by fpm
    fastcgi_pass                127.0.0.1:9000;
    ...

```

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~420 days

Total

2

Last Release

3256d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3cafae451f737abe2e33380c2d93f87968ead1c4749d1636508268a75f35bbde?d=identicon)[sixdayz](/maintainers/sixdayz)

---

Top Contributors

[![sixdayz](https://avatars.githubusercontent.com/u/1536888?v=4)](https://github.com/sixdayz "sixdayz (16 commits)")[![ricbra](https://avatars.githubusercontent.com/u/872886?v=4)](https://github.com/ricbra "ricbra (2 commits)")[![akondas](https://avatars.githubusercontent.com/u/8239917?v=4)](https://github.com/akondas "akondas (1 commits)")[![Maks3w](https://avatars.githubusercontent.com/u/1301698?v=4)](https://github.com/Maks3w "Maks3w (1 commits)")

---

Tags

symfonytaskOpcache

### Embed Badge

![Health badge](/badges/sixdays-opcache-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/sixdays-opcache-bundle/health.svg)](https://phpackages.com/packages/sixdays-opcache-bundle)
```

###  Alternatives

[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[jmose/command-scheduler-bundle

This Symfony bundle will allow you to schedule all your commands just like UNIX crontab

3361.4M1](/packages/jmose-command-scheduler-bundle)[smart-core/accelerator-cache-bundle

Provides a command line task to clear PHP Accelerators cache from the console

671.4M3](/packages/smart-core-accelerator-cache-bundle)[dukecity/command-scheduler-bundle

This Symfony bundle will allow you to schedule all your commands just like UNIX crontab

26377.3k6](/packages/dukecity-command-scheduler-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

9410.8k](/packages/ahmed-bhs-doctrine-doctor)[ecotone/symfony-bundle

Ecotone for Symfony — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Symfony Messenger, via PHP attributes.

11249.0k1](/packages/ecotone-symfony-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
