All you need to do to use the package is to install it via composer:
composer require tallstackui/envbar:^0.1.0@beta
After that, the EnvBar will be injected on your application.
- Publishing the config file:
php artisan vendor:publish --tag=envbar-config
Almost all the configuration is done through environment variables. Here are the available environment variables:
ENVBAR_ENABLED
: Enable/disable the package. Default istrue
.ENVBAR_DISABLE_ON_TESTS
- Enable/disable the package on tests. Default istrue
.ENVBAR_SIZE
- Set the size of the bar. Allowed: xs, sm, md, lg, xl. Default ismd
.ENVBAR_FIXED
- If the bar should be fixed at the top. Default istrue
.ENVBAR_TAILWIND_BREAKING_POINTS
- If the TailwindCSS breakpoints should be displayed.ENVBAR_WARNING_MESSAGE
- Allows you to set a warning message.ENVBAR_CLOSABLE_ENABLED
- If the close button should be displayed. Default istrue
.ENVBAR_CLOSABLE_TIMEOUT
- If after closing the bar, it should be displayed again after a certain time, in minutes. Default isnull
.ENVBAR_LINKS
- Set a list of links to be displayed on the right side of the EnvBar as a dropdown. Example:ENVBAR_LINKS="https://google.com.br,https://github.com"
.ENVBAR_FOR_AUTHENTICATED_USERS_ENABLED
- If the bar should be displayed only for authenticated users. Default isfalse
. Requires a Gate to be defined withenvbar::view
ability, similar we do with Horizon, but withenvbar::view
ability.ENVBAR_FOR_AUTHENTICATED_USERS_GUARD
- The default guard to be used for authenticated users. Default isweb
.ENVBAR_ON_MOBILE
- If the bar should be displayed on mobile. Default isfalse
.ENVBAR_PROVIDER
- The provider to be used for fetching the last release. Allowed: github, bitbucket, envoyer. Default isnull
.ENVBAR_GITHUB_TOKEN
- GitHub token to be used for fetching the last release.ENVBAR_GITHUB_REPOSITORY
- GitHub repository to be used for fetching the last release.ENVBAR_GITHUB_DAYS_FOR_CACHE
- The time in days to cache the last release. Default is1
.ENVBAR_BITBUCKET_TOKEN
- BitBucket token to be used for fetching the last release.ENVBAR_BITBUCKET_REPOSITORY
- BitBucket repository to be used for fetching the last release.ENVBAR_BITBUCKET_DAYS_FOR_CACHE
- The time in days to cache the last release. Default is1
.ENVBAR_ENVOYER_TOKEN
- Envoyer token to be used for fetching the last release.ENVBAR_ENVOYER_PROJECT_ID
- Envoyer project id to be used for fetching the last release.ENVBAR_ENVOYER_DAYS_FOR_CACHE
- The time in days to cache the last release. Default is1
.
In the config file you can configure the environments and the colors for each environment:
'environments' => [
'local' => 'green',
'staging' => 'yellow',
'sandbox' => 'orange',
// 'production' => 'red',
],
- The production environment is not included by default. If you want to include it, you can uncomment the line.
- All the colors are TailwindCSS colors, except: black and white.
You can ignore the EnvBar for specific pages:
'ignore_on' => [
'pulse/*',
'horizon/*',
'telescope/*',
],
Behind the scenes, this feature uses Request::is
to check the current route.
To avoid multiple requests to the git provider, the latest release is cached for ENVBAR_*_CACHED_FOR
day(s). If you want to clear the release cache, you can clear the entire application cache or run the following command to clear the release cache only, without affecting the other cache:
php artisan envbar:flush
If you are using ENVBAR_CLOSABLE_TIMEOUT
and you closed the EnvBar, you can use the command below to show the EnvBar again without waiting for the final minutes timeout to run out:
php artisan envbar:show