isaeken/envman

Manage your Laravel environment runtime

v1.0 2022-09-18 16:13 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Support us

68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f456e764d616e2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d697361656b656e253246656e766d616e267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d4d616e6167652b796f75722b656e7669726f6e6d656e742b64796e616d6963616c6c79266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d68747470732533412532462532466c61726176656c2e636f6d253246696d672532466c6f676f6d61726b2e6d696e2e737667

Manage your Laravel application's environment variables dynamically so fast.

Installation

You can install the package via composer:

composer require isaeken/envman

You can publish and run the migrations with:

php artisan vendor:publish --tag="envman-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="envman-config"

This is the contents of the published config file:

return [
    'enabled' => env('ENVMAN_ENABLED', true),

    'cache' => env('APP_ENV', 'production') === 'production',

    'features' => [
        // custom configs for domains
        'domains' => true,
    ],

    'database' => [
        'connection', env('DB_CONNECTION'),
    ],
];

Usage

You can change environment variables dynamically:

\IsaEken\Envman\Facades\Envman::setConfig('app.name', 'Your App Name');
\IsaEken\Envman\Facades\Envman::setConfig('app.debug', false);
\IsaEken\Envman\Facades\Envman::setConfig('app.environment', 'production');

And you can reset variables:

\IsaEken\Envman\Facades\Envman::resetConfig('app.debug');

Commands

# Reset all your environment changes
php artisan envman:reset
# Cache all environment variables
php artisan envman:cache
# Clear all environment variable cache
php artisan envman:cache:clear

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.