定制 akmnahid/laravel-local-env-support 二次开发

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

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

akmnahid/laravel-local-env-support

Composer 安装命令:

composer require akmnahid/laravel-local-env-support

包简介

The laravel-local-env-support plugin allows Laravel developers to seamlessly integrate environment-specific .env.local configurations, enhancing adaptability across different development stages.

README 文档

README

License Total Downloads

A Laravel package to add support for .env.local files, allowing you to override environment variables defined in the main .env file without modifying it. This is particularly useful for local development and testing environments.

Table of Contents

Installation

You can install this package via Composer:

composer require akmnahid/laravel-local-env-support

To install directly from VCS repository in your composer.json:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/akmnahid/laravel-local-env-support"
        }
    ],
    "require": {
        "akmnahid/laravel-local-env-support": "dev-main"
    }
}

Then run:

composer update

Usage

  1. Create a .env.local file in the root directory of your Laravel project.

  2. Add environment variables to .env.local that you wish to override from the main .env file.

    Example .env.local:

    APP_DEBUG=true
    DB_HOST=localhost
  3. Ensure .env.local is added to your .gitignore file to prevent it from being committed to version control.

  4. Clear the configuration cache if you have previously cached your configurations:

    php artisan config:clear
  5. Run your application as usual. Variables defined in .env.local will override those in .env.

Features

  • Override Environment Variables: Variables in .env.local will override those defined in .env.

  • Easy to Use: Simply install the package and create a .env.local file.

  • Auto-Discovery: The package uses Laravel's auto-discovery feature, so no additional setup is required.

Requirements

  • PHP: >=7.3
  • Laravel: >=8.0
  • Dependencies:
    • vlucas/phpdotenv: >=5.5

License

This project is licensed under the MIT License. See the LICENSE file for details.

Additional Notes

  • Environment File Order: The variables in .env.local will override those in .env. This allows you to keep default settings in .env and customize only the necessary variables in .env.local.

  • Version Control: It's recommended to add .env.local to your .gitignore file to prevent sensitive data from being committed to your repository.

  • Configuration Caching: If you cache your configurations using php artisan config:cache, remember to clear the cache whenever you make changes to your environment files.

    php artisan config:clear
  • Auto-Discovery: This package supports Laravel's package auto-discovery, so you don't need to manually add the service provider to your config/app.php file.

  • To Add Manually: Add following to your config/app.php file:

'providers' => [
    // Other Service Providers

    \LaravelEnvLocal\EnvLocalServiceProvider::class, // Add this line
],

Troubleshooting

  • Variables Not Overriding: If the variables from .env.local are not overriding those from .env, ensure that:

    • The .env.local file is located in the root directory of your Laravel project.
    • You have cleared the configuration cache using php artisan config:clear.
    • There are no syntax errors in your .env.local file.
  • Cache Issues: Remember that environment variables are cached when you run php artisan config:cache. Always clear the cache after making changes to your environment files.

Credits

Support

If you encounter any issues or have questions, feel free to open an issue on GitHub .

Versioning

This project adheres to Semantic Versioning. For the versions available, see the tags on this repository.

Changelog

All notable changes to this project will be documented in this section.

  • v1.0.3: Updated readme.md
  • v1.0.2: Updates with new codebases
  • v1.0.1: Initial release with support for loading .env.local files.
  • v1.0.0: Initial release with support for loading .env.local files.

Feel free to customize and extend this package to suit your specific needs. Contributions and suggestions are welcome!

akmnahid/laravel-local-env-support 适用场景与选型建议

akmnahid/laravel-local-env-support 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 10 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「akmnahid」 「laravel-env-local-support」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 akmnahid/laravel-local-env-support 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 akmnahid/laravel-local-env-support 我们能提供哪些服务?
定制开发 / 二次开发

基于 akmnahid/laravel-local-env-support 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-01