{"id":15355588,"url":"https://github.com/elcobvg/laravel-opcache","last_synced_at":"2025-08-21T02:31:54.714Z","repository":{"id":27095038,"uuid":"112444260","full_name":"elcobvg/laravel-opcache","owner":"elcobvg","description":"Custom OPcache Cache Driver for Laravel. Faster than Redis, Memcache or APC.","archived":false,"fork":false,"pushed_at":"2021-11-28T08:33:33.000Z","size":57,"stargazers_count":45,"open_issues_count":5,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-18T08:16:05.003Z","etag":null,"topics":["cache","cache-driver","laravel","opcache","package","php7","redis"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elcobvg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-29T07:53:17.000Z","updated_at":"2024-10-24T00:34:16.000Z","dependencies_parsed_at":"2022-07-27T09:02:59.172Z","dependency_job_id":null,"html_url":"https://github.com/elcobvg/laravel-opcache","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/elcobvg/laravel-opcache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elcobvg%2Flaravel-opcache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elcobvg%2Flaravel-opcache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elcobvg%2Flaravel-opcache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elcobvg%2Flaravel-opcache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elcobvg","download_url":"https://codeload.github.com/elcobvg/laravel-opcache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elcobvg%2Flaravel-opcache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271416929,"owners_count":24755994,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","cache-driver","laravel","opcache","package","php7","redis"],"created_at":"2024-10-01T12:24:52.777Z","updated_at":"2025-08-21T02:31:54.406Z","avatar_url":"https://github.com/elcobvg.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laravel-opcache [![Build Status](https://travis-ci.org/elcobvg/laravel-opcache.svg?branch=master)](https://travis-ci.org/elcobvg/laravel-opcache)\nCustom OPcache Cache Driver for Laravel. Faster than Redis, Memcache or APC.\n\nThis package adds a cache driver to your Laravel project that uses PHP engine’s in-memory file caching (OPcache) to cache application data.\n\nThis 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!\n\n## Installation\n\nRequire this package with composer.\n\n```shell\ncomposer require elcobvg/laravel-opcache\n```\n\nLaravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.\n\nIf you don't use auto-discovery or Laravel version 5.4 or older, add the ServiceProvider to the providers array in config/app.php\n\n```php\nElcoBvg\\Opcache\\ServiceProvider::class,\n```\n\nThen, make sure you add the driver option to the stores array in config/cache.php\n\n```php\n    'opcache' =\u003e [\n        'driver' =\u003e 'opcache',\n    ],\n```\n\nAnd enable the driver in your `.env` file or in config/cache.php\n\n### OPcache configuration\n\n*OPcache can only be compiled as a shared extension. You must compile PHP with the `--enable-opcache` option for OPcache to be available.*\n\nOPcache 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. \n\nSince *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. \n\n```shell\n  opcache.enable=1\n  opcache.memory_consumption=512\n  opcache.interned_strings_buffer=64\n  opcache.max_accelerated_files=32500\n  opcache.validate_timestamps=1\n  opcache.save_comments=1\n  opcache.revalidate_freq=60\n  opcache.fast_shutdown=1\n  opcache.enable_cli=1\n```\n\n**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.\n\n### Caching Eloquent models\n\nDepending 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.\n\n### References\n\n- [500X Faster Caching than Redis/Memcache/APC in PHP \u0026 HHVM](https://blog.graphiq.com/500x-faster-caching-than-redis-memcache-apc-in-php-hhvm-dcd26e8447ad)\n- [Make your Laravel App Fly with PHP OPcache](https://medium.com/appstract/make-your-laravel-app-fly-with-php-opcache-9948db2a5f93)\n- [PHP OPcache Documentation](http://php.net/manual/en/book.opcache.php)\n- [Pecl::Package::ZendOpcache](http://pecl.php.net/package/ZendOpcache)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felcobvg%2Flaravel-opcache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felcobvg%2Flaravel-opcache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felcobvg%2Flaravel-opcache/lists"}