Download the PHP package beacon-hq/pennant-driver without Composer
On this page you can find all versions of the php package beacon-hq/pennant-driver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download beacon-hq/pennant-driver
More information about beacon-hq/pennant-driver
Files in beacon-hq/pennant-driver
Package pennant-driver
Short Description The official Beacon driver for Laravel Pennant
License MIT
Informations about the package pennant-driver
Beacon Driver for Laravel Pennant
The official Beacon driver for Laravel Pennant, enabling seamless feature flag management through the Beacon platform.
Installation
You can install the package via Composer:
The package will automatically register its service provider through Laravel's package auto-discovery.
Configuration
Environment Variables
Add the following environment variables to your .env file:
Pennant Configuration
Update your config/pennant.php file to include the Beacon driver:
Configuration Options
app_name: The name of your application as registered in Beaconenvironment: The environment name (e.g.,production,staging,local)url: The base URL of your Beacon API instancepath_prefix: The API path prefix (default:/api)cache_store: The cache store to use (default: Laravel's default cache store)cache_ttl: Cache time-to-live in seconds (default: 1800 seconds / 30 minutes)api_key: Your Beacon API authentication tokenapi_timeout: Beacon API request timeout, (recommended: no less than 100ms no greater than 3000ms)
Usage
Once configured, you can use Laravel Pennant's standard API to interact with feature flags:
Basic Feature Checking
Scoped Features
Retrieving Feature Values
Conditional Execution
Context Information
The Beacon driver automatically sends contextual information with each request:
- Scope Type: The class name of the scoped object (e.g., User, Team)
- Scope: The actual scope object or identifier
- App Name: Your application name
- Environment: Current Laravel environment
- Session ID: Current session identifier (if available)
- IP Address: Client IP address
- User Agent: Client user agent string
- Referrer: HTTP referrer header
- URL: Current request URL
- Method: HTTP request method
This context helps Beacon make intelligent feature flag decisions based on your application's state.
Caching
The driver includes built-in caching to improve performance:
- Feature responses are cached for the configured TTL (default: 30 minutes)
- Cache keys are generated based on feature names and scope serialization
- You can flush the cache using the driver's
flushCache()method
Testing
Run the test suite:
Run code style checks:
Requirements
- PHP 8.1 or higher
- Laravel 10.0 or higher
- Laravel Pennant 1.14 or higher
License
This package is open-sourced software licensed under the MIT license.
Credits
Support
For support, please contact Beacon HQ or open an issue on GitHub.
All versions of pennant-driver with dependencies
bilfeldt/laravel-http-client-logger Version ^2.4
illuminate/log Version *
laravel/pennant Version ^1.14