solar-investments/support 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

solar-investments/support

Composer 安装命令:

composer require solar-investments/support

包简介

Support package for Solar Investments

README 文档

README

Packagist Tests Dependencies

Support package for Solar Investments projects.

Installation

composer require solar-investments/support

Middleware

You can register any of the following middleware:

  • SolarInvestments\Middleware\EnableSecurePaginationLinks
  • SolarInvestments\Middleware\ForceRootUrl
  • SolarInvestments\Middleware\HideFromRobotsOnOrigin
  • SolarInvestments\Middleware\LowerPathCasing
  • SolarInvestments\Middleware\RedirectConsumerValidationRequests
  • SolarInvestments\Middleware\RemoveTrailingSlash
  • SolarInvestments\Middleware\RequireVpn
  • SolarInvestments\Middleware\SetFastlySurrogateKey

Enable Secure Pagination Links

This middleware fixes an issue where the next and prev links in the pagination response are generated using http instead of https.

Force Root URL

This middleware forces the root URL based on the incoming request.

For example, if the request is made from the origin server (origin.example.com), the middleware will adjust the application’s root URL accordingly.

It defaults to the APP_URL environment variable unless the request host differs, allowing URLs to dynamically adjust between public and origin URLs.

Hide From Robots On Origin

This middleware adds the X-Robots-Tag header to the response with the value none (same as noindex, nofollow) to prevent search engines from indexing the page. This is only done when the site is accessed directly on the origin server, e.g. http://origin.example.com instead of http://www.example.com.

Lower Path Casing

If Statamic is installed, control panel paths are not converted to lowercase.

This middleware converts the path of the request to lowercase.

Redirect Consumer Validation Requests

This middleware redirects requests for /consumer-validation/v2/* to a matching path on www.fixr.com.

Request URL Redirects To
/consumer-validation/v2/abc123?campaign=xyz https://www.fixr.com/consumer-validation/v2/abc123?campaign=xyz

This is used in marketing emails to ensure that tracking links match the sender domain but ultimately redirect to a centralized validation handler.

Remove Trailing Slash

This middleware removes the trailing slash from the path of the request.

Require VPN

This middleware restricts access to the application to specific IP addresses. This is useful when you want to restrict access to the application to only users on a VPN (or anywhere really).

To use the RequireVpn middleware, publish the configuration file:

php artisan vendor:publish --tag=vpn-config

By default, this middleware is "disabled" and all IP addresses are allowed.

To restrict access from specific IP addresses, set the VPN_IP_ADDRESSES environment variable in your .env file, e.g.:

VPN_IP_ADDRESSES=192.168.1.192,10.0.0.1/8

Alternatively, you can specify the IP addresses in the config/vpn.php file.

Set Fastly Surrogate Key

This middleware adds the Surrogate-Key header to the response with the configured value, allowing you to purge the cache for specific pages.

To use the SetFastlySurrogateKey middleware, publish the configuration file:

php artisan vendor:publish --tag=fastly-config

Then, set the surrogate_keys in the config/fastly.php file, e.g.:

return [

    'surrogate_keys' => [

        [
            /*
             * The key to use for requests that match the specified paths.
             *
             * The default key will be prepended to this value.
             */
            'key' => 'meals',

            /*
             * List of paths that should use the specified key.
             *
             * A path is a match if it starts with any of the specified paths.
             * 
             * Note: Paths are case-insensitive. The forward slash is optional.
             */
            'paths' => [
                'breakfast',
                'lunch',
                'dinner',
            ],
        ],

    ],

    // ...

];

Service Providers

HelioServiceProvider

This provider conditionally bootstraps Helio-specific configuration.

It listens for Laravel's internal bootstrap events and applies environment-aware configuration such as:

Logging

Replaces the default log channel with a stderr Monolog driver using GoogleCloudLoggingFormatter and dynamic log levels (debug in non-production, warning in production).

Statamic

If Statamic is installed, it injects environment-aware git commit commands for Statamic's content publishing pipeline. This includes metadata like the current environment, project, and git user/email.

URLs

When the application is not running locally, the UrlServiceProvider forces the https scheme for all URLs generated by Laravel.

Testing Traits

SkipTestWhenRunningCI

This trait can be used to skip tests when running in a CI environment.

use SolarInvestments\Testing\SkipTestWhenRunningCI;

class ExampleTest extends TestCase
{
    use SkipTestWhenRunningCI;

    public function test_example()
    {
        // ...
    }
}

solar-investments/support 适用场景与选型建议

solar-investments/support 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21.05k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 solar-investments/support 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-14