定制 samsmithcodes/environment-banner 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

samsmithcodes/environment-banner

最新稳定版本:1.1.0

Composer 安装命令:

composer require samsmithcodes/environment-banner

包简介

Display a banner to indicate the current environment.

关键字:

README 文档

README

This package adds a banner to your applications UI to display the current environment.

We have all have a moment where we confuse the environment we are in, maybe you accidentally did something on the production system that should have been done on UAT, or you just want to indicate to end users which environment they are using.

A screenshot of the environment banner.

Assumptions

This package assumes you are using Tailwind for your styling, so out of the box it uses Tailwind classes but of course you can customize this to fit your needs if you publish the view files.

Installing

To install this package, run the following composer command:

composer require samsmithcodes/environment-banner

Publish Files

You can publish the config and view files to your application for customization, just run the following commands:

php artisan vendor:publish --tag=environment-banner-config
php artisan vendor:publish --tag=environment-banner-view

Rendering The Banner

To render the banner in your application, include the following component.

<x-environment-banner />

Tailwind Classes

Because we set the color classes at runtime, Tailwind will not know about them, so to ensure Tailwind includes them, you should add them to the safe list, for example, in Tailwind v4 you can do this by adding the following to your app.css:

@source inline("bg-green-300 dark:bg-green-600");

Obviously define the classes you intend to use and then build your assets.

Development

To develop the package, you should first setup a clean Laravel project and then create a new directory called packages/samsmithcodes/environment-banner.

Then, checkout this repository into that directory.

git clone git@github.com:samsmithcodes/environment-banner.git

Install the package dependencies with composer install.

To install the package to test, go back to the root of the Laravel project you setup and add the following to the composer.json file.

"repositories": [
    {
        "type": "path",
        "url": "./packages/samsmithcodes/environment-banner",
        "options": {
            "symlink": true
        }
    }
],

Then, run the following composer command to install the package.

composer require samsmithcodes/environment-banner:@dev

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-16