PHPackages                             icedevelopment/apc-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. icedevelopment/apc-bundle

ActiveSymfony-bundle

icedevelopment/apc-bundle
=========================

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

v5.0(3y ago)01.2kMITPHP

Since Aug 4Pushed 3y ago1 watchersCompare

[ Source](https://github.com/icedevelopment/ApcBundle)[ Packagist](https://packagist.org/packages/icedevelopment/apc-bundle)[ Docs](https://github.com/ornicar/ApcBundle)[ RSS](/packages/icedevelopment-apc-bundle/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (1)Versions (22)Used By (0)

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

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

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

Prerequisite
============

[](#prerequisite)

If you want to clear Apache part of APC, you will need to enable `allow_url_fopen` in `php.ini` to allow opening of URL object-like files, or set the curl option.

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

[](#installation)

1. Add it to your composer.json:

    ```
    {
        "require": {
            "ornicar/apc-bundle": "1.0.*"
        }
    }
    ```

    or:

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

    ```
     // app/AppKernel.php
     public function registerBundles()
     {
         return array(
             // ...
             new Ornicar\ApcBundle\OrnicarApcBundle(),
             // ...
         );
     }

    ```
3. Configure `ornicar_apc` service:

    ```
     # app/config/config.yml
     ornicar_apc:
         host: http://example.com
         web_dir: %kernel.root_dir%/../web

    ```
4. If you want to use curl rather than fopen set the following option:

    ```
     # app/config/config.yml
     ornicar_apc:
         ...
         mode: curl

    ```

Usage
=====

[](#usage)

Clear all APC cache (opcode+user):

```
      $ php app/console apc:clear

```

Clear only opcode cache:

```
      $ php app/console apc:clear --opcode

```

Clear only user cache:

```
      $ php app/console apc:clear --user

```

Clear the CLI cache (opcode+user):

```
      $ php app/console apc:clear --cli

```

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

[](#capifony-usage)

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

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

and add these hooks

```
# apc
after "deploy", "symfony:clear_apc"
after "deploy:rollback:cleanup", "symfony:clear_apc"
```

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

[](#nginx-configuration)

If you are using nginx and limiting PHP scripts that you are passing to fpm you need to allow 'apc' 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 apc cache.

Example configuration:

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

```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~189 days

Recently: every ~283 days

Total

18

Last Release

1451d ago

Major Versions

1.0.8 → 2.0.02017-06-19

v2.0.1 → v3.0.02018-01-25

v3.1.1 → v4.02022-03-31

v4.0 → v5.02022-05-27

### Community

Maintainers

![](https://www.gravatar.com/avatar/67c05552a9715747a97dc13f5f2c8064e9c7c15a7a001f75b6c0856b938b645a?d=identicon)[icedevelopment](/maintainers/icedevelopment)

---

Top Contributors

[![ornicar](https://avatars.githubusercontent.com/u/140370?v=4)](https://github.com/ornicar "ornicar (19 commits)")[![shieldo](https://avatars.githubusercontent.com/u/97280?v=4)](https://github.com/shieldo "shieldo (13 commits)")[![eymengunay](https://avatars.githubusercontent.com/u/242627?v=4)](https://github.com/eymengunay "eymengunay (6 commits)")[![icedevelopment](https://avatars.githubusercontent.com/u/4964448?v=4)](https://github.com/icedevelopment "icedevelopment (3 commits)")[![tborealis](https://avatars.githubusercontent.com/u/1591228?v=4)](https://github.com/tborealis "tborealis (3 commits)")[![dmecke](https://avatars.githubusercontent.com/u/1172148?v=4)](https://github.com/dmecke "dmecke (2 commits)")[![helmer](https://avatars.githubusercontent.com/u/586545?v=4)](https://github.com/helmer "helmer (2 commits)")[![shtumi](https://avatars.githubusercontent.com/u/604334?v=4)](https://github.com/shtumi "shtumi (1 commits)")[![tjoelsson](https://avatars.githubusercontent.com/u/2793514?v=4)](https://github.com/tjoelsson "tjoelsson (1 commits)")[![antonbabenko](https://avatars.githubusercontent.com/u/393243?v=4)](https://github.com/antonbabenko "antonbabenko (1 commits)")[![toaotc](https://avatars.githubusercontent.com/u/871030?v=4)](https://github.com/toaotc "toaotc (1 commits)")[![cordoval](https://avatars.githubusercontent.com/u/328359?v=4)](https://github.com/cordoval "cordoval (1 commits)")[![garak](https://avatars.githubusercontent.com/u/179866?v=4)](https://github.com/garak "garak (1 commits)")[![jkm9000](https://avatars.githubusercontent.com/u/21393?v=4)](https://github.com/jkm9000 "jkm9000 (1 commits)")[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (1 commits)")[![ondrowan](https://avatars.githubusercontent.com/u/423776?v=4)](https://github.com/ondrowan "ondrowan (1 commits)")[![polem](https://avatars.githubusercontent.com/u/379985?v=4)](https://github.com/polem "polem (1 commits)")

---

Tags

taskapc

### Embed Badge

![Health badge](/badges/icedevelopment-apc-bundle/health.svg)

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

###  Alternatives

[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)[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)[rewieer/taskschedulerbundle

Task Scheduler with CRON for Symfony

63242.1k](/packages/rewieer-taskschedulerbundle)[dukecity/command-scheduler-bundle

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

25350.9k5](/packages/dukecity-command-scheduler-bundle)[sixdays/opcache-bundle

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

3061.3k](/packages/sixdays-opcache-bundle)[cleverage/process-bundle

Process, import/export, transform and validate data with a simple API with Symfony3

2052.2k13](/packages/cleverage-process-bundle)

PHPackages © 2026

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