Download the PHP package azaharizaman/nexus-feature-flags without Composer
On this page you can find all versions of the php package azaharizaman/nexus-feature-flags. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download azaharizaman/nexus-feature-flags
More information about azaharizaman/nexus-feature-flags
Files in azaharizaman/nexus-feature-flags
Package nexus-feature-flags
Short Description Production-grade feature flag management with context-based evaluation, percentage rollout, and kill switches
License MIT
Informations about the package nexus-feature-flags
Nexus\FeatureFlags
Production-grade feature flag management with context-based evaluation, percentage rollout, tenant inheritance, and kill switches. Framework-agnostic pure PHP 8.3+ package designed for Laravel, Symfony, Slim, and vanilla PHP applications.
Features
- ๐ฏ Context-Based Evaluation - 5 strategies: System-Wide, Percentage Rollout, Tenant List, User List, Custom
- ๐ Fail-Closed Security - Flags default to disabled when not found
- ๐ข Tenant Inheritance - Tenant-specific flags override global defaults
- ๐ฆ Kill Switches - Force ON/OFF overrides for emergency control
- โก Performance Optimized - Request-level memoization, bulk evaluation API
- ๐ Checksum Validation - Prevents stale cache serving
- ๐ Observability Ready - Optional monitoring and audit logging integration
- ๐งช 100% Type-Safe - Strict types, native enums, immutable value objects
Installation
For Laravel
The service provider will be auto-discovered. Publish the migration:
For Symfony
Register services in config/services.yaml:
For Vanilla PHP
Quick Start
Basic Usage
Context-Based Evaluation
Bulk Evaluation (Prevents N+1 Queries)
Flag Strategies
1. System-Wide
Enabled/disabled for all users globally.
2. Percentage Rollout
Gradually roll out to a percentage of users based on stable identifier.
3. Tenant List
Enabled only for specific tenants.
4. User List
Enabled only for specific users.
5. Custom Evaluator (Advanced)
Use custom business logic for complex targeting.
Override Precedence (Kill Switches)
Force flags ON or OFF regardless of strategy for emergency control.
Tenant Inheritance
Tenant-specific flags automatically override global defaults.
Name Validation
Flag names must follow strict pattern for consistency and safety:
- Pattern:
/^[a-z0-9_\.]{1,100}$/ - Valid:
new_feature,module.analytics,beta_v2.checkout - Invalid:
NewFeature(uppercase),feature-name(hyphens),very_long_name...(>100 chars)
Testing
Framework Integration Examples
Laravel Setup
After installation, the FeatureFlagServiceProvider auto-registers. Configure in config/feature-flags.php:
API Usage:
Blade Directives (Optional Custom Helper):
Symfony Setup
services.yaml:
Controller Usage:
Twig Extension (Optional):
Slim Framework Setup
Standalone PHP Setup
Compliance & Audit Trail
For regulatory compliance (SOX, GDPR, etc.), the package provides optional audit interfaces that enable complete change tracking and historical state queries.
Audit Architecture
FlagAuditChangeInterface (Write Audit)
Records all feature flag modifications using Nexus\AuditLogger:
FlagAuditQueryInterface (Read Audit)
Query historical flag states using Nexus\EventStream for compliance audits:
Using AuditableFlagRepository
The AuditableFlagRepository decorator automatically records all changes:
Audit Actions
The AuditAction enum tracks all possible flag modifications:
| Action | Description | Critical |
|---|---|---|
CREATED |
Flag was created | No |
UPDATED |
Flag was updated (generic) | No |
DELETED |
Flag was deleted | Yes |
ENABLED_CHANGED |
Flag enabled state toggled | No |
STRATEGY_CHANGED |
Evaluation strategy changed | No |
OVERRIDE_CHANGED |
Override state changed | Yes |
FORCE_ENABLED |
FORCE_ON override applied | Yes |
FORCE_DISABLED |
FORCE_OFF override (kill switch) | Yes |
OVERRIDE_CLEARED |
Override removed | No |
ROLLOUT_CHANGED |
Percentage rollout changed | No |
TARGET_LIST_CHANGED |
Tenant/user list changed | No |
Checking Audit Availability
Laravel Service Provider Setup
Requirements
- PHP 8.3+
- PSR-3 Logger implementation
- (Optional) Nexus\Telemetry for metrics
- (Optional) Nexus\AuditLogger for change audit trail
- (Optional) Nexus\EventStream for historical state queries
๐ Documentation
Core Documentation
- Getting Started Guide - Quick start with prerequisites, 5 strategies, and troubleshooting
- API Reference - Complete interface and service documentation
- Integration Guide - Laravel and Symfony integration examples
Implementation Details
- Requirements - Complete requirements tracking with status
- Implementation Summary - Progress metrics and design decisions
- Test Suite Summary - Test coverage and testing strategy
- Valuation Matrix - Package valuation metrics ($145K value, 1,364% ROI)
Code Examples
- Basic Usage Examples - Simple feature flag operations
- Advanced Usage Examples - Custom evaluators, percentage analysis
Quick Links
- Package Reference:
docs/NEXUS_PACKAGES_REFERENCE.md - Architecture Overview:
ARCHITECTURE.md - Coding Standards:
.github/copilot-instructions.md
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
The MIT License (MIT). Please see License File for more information.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Nexus Team
- All Contributors