Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Module Apc Laravel Package

codeception/module-apc

Codeception APC module adds caching support to your tests by integrating PHP’s APC/APCu. Clear, inspect, and manage cache entries during functional and acceptance runs to keep suites isolated and predictable.

View on GitHub
Deep Wiki
Context7

Getting Started

This package is a legacy module for Codeception to interact with PHP's deprecated APC (Alternative PHP Cache) extension. Since APC was deprecated in PHP 5.5 and removed entirely in PHP 7.0, this module is only relevant for testing very old PHP codebases still running on PHP 5.x. To begin:

  1. Ensure your test environment is running PHP ≤ 5.6 with the apc extension enabled (extension=apc.so or extension=apc.dll).
  2. Install via Composer: composer require --dev codeception/module-apc
  3. Enable the module in codeception.yml or suite config:
    modules:
      enabled:
        - APC
    
  4. First use case: Clear APC cache between test runs to avoid stale data — call $I->amInCache(); $I->haveInCache('key', 'value'); $I->clearCache();

Implementation Patterns

  • Cache population for tests: Stub cache-dependent logic by pre-populating APC data using $I->haveInCache($key, $value, $ttl) before your SUT (System Under Test) runs.
  • Cache assertion patterns: Assert presence, absence, or values in APC:
    $I->seeInCache('user_session_123');
    $I->dontSeeInCache('expired_token');
    $I->grabFromCache('config_key'); // returns value or null
    
  • Integration with Acceptance/Functional tests: Use in isolation-sensitive suites (e.g., when testing session handlers, caching layers, or legacy bootstrap logic) where side-effect isolation requires APC clearing between scenarios.
  • Per-test fixture setup: Combine with Helper\Actor methods to abstract cache seeding, e.g., setupTestUserDataInCache() for user-facing tests.

Gotchas and Tips

  • Severely deprecated environment: APC no longer ships or works on PHP ≥ 7.0. Do not use this on modern apps. Prefer codeception/module-redis or codeception/module-memcached instead.
  • APC vs APCu confusion: This module targets the original APC (with user caching via apc_* functions), not APCu. APCu lacks the opcode caching parts, but this module only works with APC’s user cache API.
  • Test environment fragility: APC state persists per SAPI (CLI vs Apache). In CLI tests, ensure apc.enable_cli=1 in php.ini, or you’ll get empty cache — leading to false-negative assertions.
  • No support for modern fallbacks: If your app checks for function_exists('apcu_*'), this module won’t help — it doesn’t simulate APCu or fall back to filesystem caching.
  • Debugging tip: Use $I->debugSection('APC', print_r(apc_cache_info('user'), true)); inside a test to inspect real-time APC stats.
  • Migration path: When upgrading from PHP 5.x → modern PHP, remove this module entirely and refactor tests to mock cache interfaces instead of relying on extension-specific helpers.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport