Download the PHP package mohamedhekal/laravel-featurebox without Composer
On this page you can find all versions of the php package mohamedhekal/laravel-featurebox. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mohamedhekal/laravel-featurebox
More information about mohamedhekal/laravel-featurebox
Files in mohamedhekal/laravel-featurebox
Package laravel-featurebox
Short Description A simple, flexible feature toggle system for Laravel โ control the visibility of features across environments, users, and conditions.
License MIT
Informations about the package laravel-featurebox
Laravel FeatureBox
A simple, flexible feature toggle system for Laravel โ control the visibility of features across environments, users, and conditions.
๐ Table of Contents
- Introduction
- Features
- Requirements
- Quick Start
- Installation
- Usage
- API Reference
- Feature Conditions
- Artisan Commands
- Configuration
- Database Schema
- Security
- Testing
- Roadmap
- Support
- Examples
๐ Introduction
Laravel FeatureBox is a lightweight Laravel package that helps you manage feature flags in your application.
Whether you're rolling out features gradually, testing beta features for specific users, or disabling features in production โ FeatureBox gives you full control.
Inspired by tools like LaunchDarkly, but made for Laravel.
โจ Features
- ๐ Simple & Lightweight - Easy to install and use
- ๐ง Flexible Conditions - Support for environments, user roles, dates, and custom conditions
- โก High Performance - Built-in caching support
- ๐ ๏ธ Artisan Commands - Manage features from the command line
- ๐ Secure - No external API calls, all logic is local
- ๐ Database Storage - Features stored in your database
- ๐งช Testable - Comprehensive test suite included
- ๐ Multi-language - Documentation in English and Arabic
๐ Requirements
- PHP >= 8.1
- Laravel >= 10.0
- MySQL/PostgreSQL/SQLite
๐ Quick Start
๐ฆ Installation
Install via Composer:
Then publish the config and migration files:
โ๏ธ Usage
Enable or disable features from the database or using Artisan commands.
Basic Usage
With Context
You can pass context to evaluate conditions:
In Blade Templates
In Controllers
๐ API Reference
Core Methods
FeatureBox::isEnabled(string $feature, array $context = []): bool
Check if a feature is enabled for the given context.
FeatureBox::isDisabled(string $feature, array $context = []): bool
Check if a feature is disabled (opposite of isEnabled
).
FeatureBox::enable(string $feature, array $conditions = []): bool
Enable a feature with optional conditions.
FeatureBox::disable(string $feature): bool
Disable a feature.
FeatureBox::get(string $feature): ?array
Get detailed information about a feature.
FeatureBox::all(): array
Get all features with their status.
๐ง Feature Conditions
Each feature can include optional conditions like:
- โ
Environments (
local
,staging
,production
) - ๐ค User roles or specific user IDs
- ๐ Start/end dates
- ๐ง Custom JSON conditions
Example Conditions
Conditions will be evaluated dynamically before enabling any feature.
๐งช Artisan Commands
Enable a Feature
Disable a Feature
List All Features
๐ง Configuration
The package configuration is located at config/featurebox.php
:
Environment Variables
๐ Database Schema
The package creates a features
table with the following structure:
๐ Security
All logic is scoped locally; no external API calls or tracking. You can optionally cache the features for performance using Laravel's cache system.
๐งช Testing
Example Test
โ Roadmap
- [x] Feature toggle logic
- [x] JSON-based conditions
- [x] Artisan commands
- [x] Caching support
- [ ] Web UI dashboard
- [ ] A/B testing support
- [ ] Redis driver
- [ ] Feature analytics
๐ Support
- Documentation: GitHub Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: [email protected]
๐งโ๐ป Developed by Mohamed Hekal
Feel free to submit issues, ideas, or pull requests.
๐ค Contributing
Please see CONTRIBUTING.md for details.
๐ License
This package is open-sourced under the MIT license.
๐ Examples
E-commerce Example
Beta Testing Example
Environment-Specific Features
Gradual Rollout
All versions of laravel-featurebox with dependencies
laravel/framework Version ^10.0|^11.0
illuminate/support Version ^10.0|^11.0