PHPackages                             dreadnip/chop - 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. [Caching](/categories/caching)
4. /
5. dreadnip/chop

ActiveLibrary[Caching](/categories/caching)

dreadnip/chop
=============

Clear opcache through php-fpm

1.0.2(9mo ago)14116.8k↓60.5%1PHPPHP ^8.0CI passing

Since Jan 9Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/sanderdlm/chop)[ Packagist](https://packagist.org/packages/dreadnip/chop)[ RSS](/packages/dreadnip-chop/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (5)Versions (12)Used By (0)

chop
====

[](#chop)

Reset the OPcache content from the CLI, without reloading PHP-FPM.

Operates the same way [cachetool](https://github.com/gordalina/cachetool) does, but is much smaller. Chop can only do one thing: clear the opcache content. There is no support for the APCu cache, realpath cache and none of the extra opcache commands that cachetool has.

Chop also has no dependencies besides [hollodotme/fast-cgi-client](https://github.com/hollodotme/fast-cgi-client). This makes it unlikely to conflict with the dependencies of your own project. Because of this, there is no need to use Chop as a PHAR. Installing it through Composer results in easier coupling with the PHP version of your application.

Installation
------------

[](#installation)

```
composer require dreadnip/chop

```

Usage
-----

[](#usage)

This is a single-command application, so calling the binary is enough:

```
php /path/to/your/project/vendor/bin/chop

```

By default, the command will print a success message or error to the console. You can suppress this output with the `-q` option.

```
php /path/to/your/project/vendor/bin/chop -q

```

The tool attempts to use sane defaults:

If no argument is passed, it'll look for a php-fpm socket file in the following places:

```
private const POSSIBLE_SOCKET_FILE_PATTERNS = [
    '~/.sock/*.sock',
    '/var/run/php*.sock',
    '/var/run/php/*.sock',
    '/var/run/php-fpm/*.sock',
];
```

This should find your socket file on most Linux distributions. If we forgot a common location, please open an issue/PR.

If multiple socket files are found, it'll try to select one by checking the filename for both the major and minor number of your PHP version.

For example: if your server has the followning socket files, and you're running PHP 8.1, it'll select the socket file with both 8 and 1 in the filename.

```
php_80_fpm_sites.sock
**php_81_fpm_sites.sock**
php_82_fpm_sites.sock
```

When no file socket file can be found, it will default to 127.0.0.1:9000.

If the defaults don't work for you, you can also explicitly pass an IP address or a path to a socket file using the --fcgi option:

```
php /path/to/your/project/vendor/bin/chop --fcgi /var/run/php-fpm.sock

```

Deployer integration
--------------------

[](#deployer-integration)

Define a task with the command

```
task('clear:opcache', function () {
    run('{{bin/php}} {{ release_path }}/vendor/bin/chop');
});

```

Call the task after your deployment

```
after('deploy:symlink', 'clear:opcache');

```

Or run it manually

```
dep clear:opcache stage=production -vvv

```

Credit
------

[](#credit)

This tool is of course inspired and based on the awesome [cachetool](https://github.com/gordalina/cachetool).

Just like cachetool, the FastCGI socket code is handled by [hollodotme/fast-cgi-client](https://github.com/hollodotme/fast-cgi-client).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance58

Moderate activity, may be stable

Popularity40

Moderate usage in the ecosystem

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~112 days

Recently: every ~235 days

Total

10

Last Release

299d ago

Major Versions

0.0.7 → 1.0.02024-04-11

PHP version history (3 changes)0.0.1PHP ^8.1

0.0.3PHP ^7.4 || ^8.1

0.0.7PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/179d3921ac9d44fa878e41369464e08f45f322cde7fcc6d3764dc7268f25e0b7?d=identicon)[sanderdlm](/maintainers/sanderdlm)

---

Top Contributors

[![sanderdlm](https://avatars.githubusercontent.com/u/24303072?v=4)](https://github.com/sanderdlm "sanderdlm (4 commits)")

---

Tags

cachetoolopcachephpphp-fpm

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/dreadnip-chop/health.svg)

```
[![Health](https://phpackages.com/badges/dreadnip-chop/health.svg)](https://phpackages.com/packages/dreadnip-chop)
```

###  Alternatives

[bref/bref

Bref is a framework to write and deploy serverless PHP applications on AWS Lambda.

3.4k11.0M75](/packages/bref-bref)[gordalina/cachetool

Manage your OPcache &amp; APCu cache through the CLI

1.8k3.9M5](/packages/gordalina-cachetool)[laravel/vapor-core

The kernel and invocation handlers for Laravel Vapor

41313.4M17](/packages/laravel-vapor-core)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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