https://github.com/dynamik-dev/tiny-flag
https://github.com/dynamik-dev/tiny-flag
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dynamik-dev/tiny-flag
- Owner: dynamik-dev
- License: mit
- Created: 2025-02-07T14:59:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-04T19:42:41.000Z (11 months ago)
- Last Synced: 2025-08-04T22:21:03.319Z (11 months ago)
- Language: PHP
- Size: 32.2 KB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
TinyFlag ⛳️
A dead- simple feature flagging package for Laravel.
TinyFlag is a simple feature flagging package for Laravel. It allows you to easily manage feature flags in your application.
You do not need to manually declare flags, simply write a check in your code and the flag will be created for you with the given default value.
```php
if(flag('my-feature-flag', true)) {
// do something
}
```
This will create a feature flag with the name `my-feature-flag` and the default value `true`. You can now enable or disable the flag in the database.
```php
use DynamikDev\TinyFlag\Facades\TinyFlag;
TinyFlag::enable('my-feature-flag');
TinyFlag::disable('my-feature-flag');
```
Or, using the artisan command:
```bash
php artisan flags:enable my-feature-flag
php artisan flags:disable my-feature-flag
```
## Installation
```bash
composer require dynamik-dev/tinyflag
```
After installing, you can publish and run the migrations with:
```bash
php artisan vendor:publish --tag="tiny-flag-migrations"
php artisan migrate
```
You can publish the config file with:
```bash
php artisan vendor:publish --tag="tiny-flag-config"
```
## Default Flags
To add default flags, you can add them to the `flags` array in the config file.
```php
'flags' => [
'my-feature-flag' => true,
]
```
This will be the default state of the flag. If the flag is updated in the database, it will override the default value. However, if you reset all flags, the default value will be used again. See more in the [Configuration](docs/configuration.md) section.
## Why not use Laravel Pennant?
Pennant is a great package, but for 90% of my usecases, I just needed a simple boolean check that I could easily manage in the database.
Use Pennant if you need more complex feature flagging, such as per-user flags, or flagging based on a user's role or other attributes.
### Documentation
- [Configuration](docs/configuration.md)
- [Artisan Commands](docs/artisan-commands.md)