mikebronner/development-settings
A Laravel package for managing development-only settings, keeping environment configuration organized and out of production. Useful for toggling debug options, feature flags, and local overrides while building and testing applications.
Installation
composer require mikebronner/development-settings
Publish the config file:
php artisan vendor:publish --provider="MikeBronner\DevelopmentSettings\DevelopmentSettingsServiceProvider" --tag="config"
Basic Configuration
Edit config/development-settings.php to define:
repositories: Array of GitHub/GitLab/Bitbucket repo URLs.settings: Key-value pairs for your dev environment (e.g., database.connections.local.host).sync_interval: How often to check for updates (in minutes).First Use Case Define a setting in your config:
// config/development-settings.php
'settings' => [
'app.debug' => true,
'mail.mailers.local.host' => 'mailhog',
],
Run the sync command:
php artisan development-settings:sync
The package will fetch the latest settings from your configured repositories and apply them to your .env file.
Repository-Based Sync
dev-settings) or a specific file (e.g., .dev-settings.yml) in each repo..dev-settings.yml in a repo:
app.debug: true
queue.connections.local.driver: sync
.env.Conditional Overrides Use Laravel’s config caching to override settings dynamically:
// config/app.php
'debug' => env('APP_DEBUG', config('development-settings.app.debug', false)),
Environment-Specific Sync
Run sync only in specific environments (e.g., local):
php artisan development-settings:sync --env=local
Scheduled Syncs Add a cron job to auto-sync settings (e.g., every 5 minutes):
* * * * * cd /path-to-project && php artisan development-settings:sync >> /dev/null 2>&1
Custom Sync Logic
Extend the SyncSettings class to add logic (e.g., validate settings before applying):
// app/Providers/DevelopmentSettingsServiceProvider.php
use MikeBronner\DevelopmentSettings\SyncSettings;
class DevelopmentSettingsServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton(SyncSettings::class, function ($app) {
return new class extends SyncSettings {
protected function validateSettings(array $settings): array
{
// Custom validation logic
return $settings;
}
};
});
}
}
.env File Conflicts
.env values for keys defined in development-settings.php. Backup your .env before syncing.APP_KEY) from sync by prefixing them in config:
'settings' => [
'!APP_KEY' => env('APP_KEY'), // Skip sync for this key
],
Git Repository Access Issues
config/development-settings.php under auth.GitRepository class).Caching Quirks
php artisan config:cache) may not reflect new settings immediately.php artisan config:clear
Merge Conflicts
.env has manual overrides, they may be lost during sync.! prefix to exclude keys or manually merge after sync.Performance with Many Repos
sync_interval to throttle requests.php artisan development-settings:sync --verbose
// In a Tinker session:
$settings = app(\MikeBronner\DevelopmentSettings\SyncSettings::class)->getSettings();
dd($settings);
Custom Data Sources
Extend MikeBronner\DevelopmentSettings\DataSources\DataSourceInterface to pull settings from:
Post-Sync Hooks
Add logic after sync via the synced event:
// In EventServiceProvider
protected $listen = [
\MikeBronner\DevelopmentSettings\Events\SettingsSynced::class => [
\App\Listeners\RestartServices::class,
],
];
UI Integration Build a dashboard to view sync status or manually trigger syncs:
Route::get('/dev-settings', function () {
return response()->json(app(\MikeBronner\DevelopmentSettings\SyncSettings::class)->getLastSync());
});
How can I help you explore Laravel packages today?