PHPackages                             jonathangoncalves/laravel-opcache - 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. jonathangoncalves/laravel-opcache

ActiveLibrary[Caching](/categories/caching)

jonathangoncalves/laravel-opcache
=================================

Custom OPcache Cache Driver for Laravel. Faster than Redis or memcached.

0.3.3(8y ago)0125MITPHPPHP &gt;=7.1.3

Since Nov 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jonathangoncalves/laravel-opcache)[ Packagist](https://packagist.org/packages/jonathangoncalves/laravel-opcache)[ Docs](https://github.com/jonathangoncalves/laravel-opcache)[ RSS](/packages/jonathangoncalves-laravel-opcache/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (4)Versions (10)Used By (0)

laravel-opcache [![Build Status](https://camo.githubusercontent.com/dc4756ac3e07697220e3fb46e8ed89eb459638544bd81412dd60b86fb76b07ac/68747470733a2f2f7472617669732d63692e6f72672f656c636f6276672f6c61726176656c2d6f7063616368652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/elcobvg/laravel-opcache)
====================================================================================================================================================================================================================================================================================================================

[](#laravel-opcache-)

Custom OPcache Cache Driver for Laravel. Faster than Redis, Memcache or APC.

This package adds a cache driver to your Laravel project that uses PHP engine’s in-memory file caching (OPcache) to cache application data.

This method is faster than Redis, Memcache, APC, and other PHP caching solutions because all those solutions must serialize and unserialize objects. By storing PHP objects in file cache memory across requests, this driver can avoid serialization completely!

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

[](#installation)

Require this package with composer.

```
composer require elcobvg/laravel-opcache
```

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

If you don't use auto-discovery or Laravel version 5.4 or older, add the ServiceProvider to the providers array in config/app.php

```
ElcoBvg\Opcache\ServiceProvider::class,
```

Then, make sure you add the driver option to the stores array in config/cache.php

```
    'opcache' => [
        'driver' => 'opcache',
    ],
```

And enable the driver in your `.env` file or in config/cache.php

### OPcache configuration

[](#opcache-configuration)

*OPcache can only be compiled as a shared extension. You must compile PHP with the `--enable-opcache` option for OPcache to be available.*

OPcache must be enabled and configured in your php.ini. Look for the section starting with `[OPcache]` and enter the desired values. The more memory you can assign to OPcache, the faster your cache will be. The `opcache.max_accelerated_files` value should be high enough to hold all objects that need to be cached.

Since *all* PHP files will be cached with OPcache, it is not advisable to use it in a development environment, so only enable it in production. Alternatively, you can exclude PHP files from being cached by specifying a blacklist file with the `opcache.blacklist_filename` option.

```
  opcache.enable=1
  opcache.memory_consumption=512
  opcache.interned_strings_buffer=64
  opcache.max_accelerated_files=32500
  opcache.validate_timestamps=1
  opcache.save_comments=1
  opcache.revalidate_freq=60
  opcache.fast_shutdown=1
  opcache.enable_cli=1
```

**Graceful degradation:** when OPcache is not enabled or installed, or memory is insufficient, this driver will still work but will read from the cached files instead of from memory. Since there's no unserialization required, it will still be faster than a regular file cache driver.

### Caching Eloquent models

[](#caching-eloquent-models)

Depending on how you've configured caching in your project, you may want to cache full Eloquent models. If so, base your model classes on `ElcoBvG\Opcache\Model` instead of the regular Eloquent base model class, so they can be retrieved correctly from cache.

### References

[](#references)

- [500X Faster Caching than Redis/Memcache/APC in PHP &amp; HHVM](https://blog.graphiq.com/500x-faster-caching-than-redis-memcache-apc-in-php-hhvm-dcd26e8447ad)
- [Make your Laravel App Fly with PHP OPcache](https://medium.com/appstract/make-your-laravel-app-fly-with-php-opcache-9948db2a5f93)
- [PHP OPcache Documentation](http://php.net/manual/en/book.opcache.php)
- [Pecl::Package::ZendOpcache](http://pecl.php.net/package/ZendOpcache)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.4% 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 ~17 days

Recently: every ~34 days

Total

9

Last Release

2947d ago

PHP version history (2 changes)0.1.1PHP &gt;=7.0

0.3.1PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/4bb03287d9893c5a0c570153877776ad7446333a7b9d81a8c16444759163ff52?d=identicon)[jonathangoncalves](/maintainers/jonathangoncalves)

---

Top Contributors

[![elcobvg](https://avatars.githubusercontent.com/u/2936937?v=4)](https://github.com/elcobvg "elcobvg (19 commits)")[![jonathangoncalves](https://avatars.githubusercontent.com/u/4118400?v=4)](https://github.com/jonathangoncalves "jonathangoncalves (2 commits)")[![RomaGilyov](https://avatars.githubusercontent.com/u/14930432?v=4)](https://github.com/RomaGilyov "RomaGilyov (1 commits)")

---

Tags

laravelwebprofilercachedriverOpcache

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jonathangoncalves-laravel-opcache/health.svg)

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

###  Alternatives

[elcobvg/laravel-opcache

Custom OPcache Cache Driver for Laravel. Faster than Redis or memcached.

43317.1k1](/packages/elcobvg-laravel-opcache)[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

975163.6k2](/packages/awssat-laravel-visits)[swayok/alternative-laravel-cache

Replacements for Laravel's redis and file cache stores that properly implement tagging idea. Powered by cache pool implementations provided by http://www.php-cache.com/

202541.1k6](/packages/swayok-alternative-laravel-cache)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)[nexxai/laravel-cfcache

A handful of Cloudflare cache helpers for Laravel

1317.7k](/packages/nexxai-laravel-cfcache)[henzeb/laravel-cache-index

Flexible replacement for tags

1213.9k](/packages/henzeb-laravel-cache-index)

PHPackages © 2026

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