Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oneduo/laravel-pennant-launchdarkly
A LaunchDarkly driver for Laravel Pennant
https://github.com/oneduo/laravel-pennant-launchdarkly
feature flags laravel launchdarkly pennant
Last synced: about 1 month ago
JSON representation
A LaunchDarkly driver for Laravel Pennant
- Host: GitHub
- URL: https://github.com/oneduo/laravel-pennant-launchdarkly
- Owner: oneduo
- License: mit
- Created: 2023-03-03T19:56:30.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-09T20:22:10.000Z (about 1 year ago)
- Last Synced: 2024-05-01T09:50:04.125Z (8 months ago)
- Topics: feature, flags, laravel, launchdarkly, pennant
- Language: PHP
- Homepage:
- Size: 37.1 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# LaunchDarkly driver for Laravel Pennant
[![Latest Version on Packagist](https://img.shields.io/packagist/v/oneduo/laravel-pennant-launchdarkly.svg?style=flat-square)](https://packagist.org/packages/oneduo/laravel-pennant-launchdarkly)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/oneduo/laravel-pennant-launchdarkly/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/oneduo/laravel-pennant-launchdarkly/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/oneduo/laravel-pennant-launchdarkly/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/oneduo/laravel-pennant-launchdarkly/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/oneduo/laravel-pennant-launchdarkly.svg?style=flat-square)](https://packagist.org/packages/oneduo/laravel-pennant-launchdarkly)A Laravel Pennant driver for LaunchDarkly.
- [Installation](#installation)
- [Usage](#usage)
* [Related documentation:](#related-documentation-)
- [Troubleshooting](#troubleshooting)
* [[E1] Scope must be an instance of LDUser](#-e1--scope-must-be-an-instance-of-lduser)
* [[E2] Not implemented, Launchdarkly driver does not support this method](#-e2--not-implemented--launchdarkly-driver-does-not-support-this-method)
- [Testing](#testing)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Security Vulnerabilities](#security-vulnerabilities)
- [Credits](#credits)
- [License](#license)## Installation
You can install the package via composer:
```bash
composer require oneduo/laravel-pennant-launchdarkly
```## Usage
You may use the driver in your existing Laravel Pennant configuration file, by setting your store's driver
to `LaunchDarklyDriver::class`.You should provide your SDK key in your store's configuration.
You may add any LaucnhDarkly cleint specific configuration options to the store's configuration.
A typical configuration might look like this:
```php
// config/pennant.phpenv('PENNANT_STORE', 'laucnhdarkly'),
/*
|--------------------------------------------------------------------------
| Pennant Stores
|--------------------------------------------------------------------------
|
| Here you may configure each of the stores that should be available to
| Pennant. These stores shall be used to store resolved feature flag
| values - you may configure as many as your application requires.
|
*/'stores' => [
// ...
'laucnhdarkly' => [
'driver' => LaunchDarklyDriver::class,
'sdk_key' => env('LAUNCHDARKLY_SDK_KEY'),
'options' => [],
],
],
];
```Then, in your scopeable Model, for instance your User model, you should implement the `FeatureScopeable`
interface, and provide a `toFeatureIdentifier` method.```php
getKey()))
// you may add more attributes to your LDUser
// ->email($this->email)
// ->firstName($this->firstname)
// ->lastName($this->lastname)
//->custom([...])
->build();
}
}
```### Related documentation
- https://docs.launchdarkly.com/sdk/features/test-data-sources#php
- https://launchdarkly.github.io/php-server-sdk/## Troubleshooting
### [E1] Scope must be an instance of LDUser
This is most likely due to either the scope you are using, or the fact that your currently authenticated user not having
implemented `FeatureScopeable` correctly.Please check the usage instructions.
### [E2] Not implemented, Launchdarkly driver does not support this method
The LaunchDarkly driver for Laravel Pennant only supports read operations, and does not support write operations. If you
need to write to LaunchDarkly, you should use the LaunchDarkly platform or the REST API.## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Charaf Rezrazi](https://github.com/rezrazi)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.