Skip to content

Conversation

@michalsn
Copy link
Member

Description

This PR adds a new FileHandler for storing settings as PHP files, providing an alternative to the existing DatabaseHandler.

Key Features:

  • File-based storage - Settings stored as PHP files with one file per class+context combination
  • Concurrent-safe - File locking with merge strategy prevents data loss from simultaneous writes
  • Organized structure - Null context files in main directory, context-specific files in hashed subdirectories
  • High performance - In-memory caching via ArrayHandler extension, bulk loading pattern, and opcache-friendly PHP format

File Structure:

writable/settings/
  ├── App_Config_Example.php              <- null context
  ├── production/                         <- hash('xxh128', 'production')
  │   └── App_Config_Example.php
  └── testing/                            <- hash('xxh128', 'testing')
      └── App_Config_Example.php

The file structure provides us with flexibility for adding new features in the future, allowing compatibility with DatabaseHandler.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn requested a review from lonnieezell October 25, 2025 16:08
@michalsn michalsn added the enhancement New feature or request label Oct 25, 2025
Copy link
Member

@lonnieezell lonnieezell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for one docs line, I think it looks great.

@michalsn michalsn merged commit 080b3bf into codeigniter4:develop Oct 28, 2025
36 of 57 checks passed
@michalsn
Copy link
Member Author

Thank you for the reviews!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants