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(6mo ago)1494.2k↓23.2%1PHPPHP ^8.0CI passing

Since Jan 9Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/sanderdlm/chop)[ Packagist](https://packagist.org/packages/dreadnip/chop)[ RSS](/packages/dreadnip-chop/feed)WikiDiscussions master Synced 1mo 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

48

—

FairBetter than 95% of packages

Maintenance70

Regular maintenance activity

Popularity39

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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

209d 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

[gordalina/cachetool

Manage your OPcache &amp; APCu cache through the CLI

1.8k3.7M5](/packages/gordalina-cachetool)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)[cheprasov/php-redis-client

Php client for Redis. It is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0

1281.2M21](/packages/cheprasov-php-redis-client)

PHPackages © 2026

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