samsonasik/force-https-module
Composer 安装命令:
composer require samsonasik/force-https-module
包简介
Force Https Module for Laminas Mvc and Mezzio application
README 文档
README
Introduction
ForceHttpsModule is a configurable module for force https in your Laminas Mvc and Mezzio Application.
This is README for version ^5.0 which only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.2.
For ^4.1.x, you can read at version 4.1.x readme which only support Laminas Mvc version 3 and Mezzio version 3 with php ^7.4|~8.0
For ~4.0.0, you can read at version 4.0.x readme which only support Laminas Mvc version 3 and Mezzio version 3 with php ^7.3|~8.0
For version ^3.0, you can read at version 3 readme which only support Laminas Mvc version 3 and Mezzio version 3 with php ^7.1.
For version ^2.0, you can read at version 2 readme which only support ZF3 and ZF Expressive version 3 with php ^7.1.
For version 1, you can read at version 1 readme which still support ZF2 and ZF Expressive version 1 and 2 with php ^5.6|^7.0 support.
Features
- Enable/disable force https.
- Force Https to All routes.
- Force Https to All routes except exclusion list.
- Force Https to specific routes only.
- Keep headers, request method, and request body.
- Enable/disable HTTP Strict Transport Security Header and set its value.
- Allow add
www.prefix during redirection from http or already https. - Allow remove
www.prefix during redirection from http or already https. - Force Https for 404 pages
Installation
1. Require this module uses composer.
composer require samsonasik/force-https-module
2. Copy config
a. For Laminas Mvc application, copy force-https-module.local.php.dist config to your local's autoload and configure it
| source | destination |
|---|---|
| vendor/samsonasik/force-https-module/config/force-https-module.local.php.dist | config/autoload/force-https-module.local.php |
Or run copy command:
cp vendor/samsonasik/force-https-module/config/force-https-module.local.php.dist config/autoload/force-https-module.local.php
b. For Mezzio application, copy mezzio-force-https-module.local.php.dist config to your local's autoload and configure it
| source | destination |
|---|---|
| vendor/samsonasik/force-https-module/config/mezzio-force-https-module.local.php.dist | config/autoload/mezzio-force-https-module.local.php |
Or run copy command:
cp vendor/samsonasik/force-https-module/config/mezzio-force-https-module.local.php.dist config/autoload/mezzio-force-https-module.local.php
When done, you can modify your local config:
<?php // config/autoload/force-https-module.local.php or config/autoload/mezzio-force-https-module.local.php return [ 'force-https-module' => [ 'enable' => true, 'force_all_routes' => true, 'force_specific_routes' => [ // only works if previous's config 'force_all_routes' => false 'checkout', 'payment' ], 'exclude_specific_routes' => [ // a lists of specific routes to not be https // only works if previous config 'force_all_routes' => true 'non-https-route', ], // set HTTP Strict Transport Security Header 'strict_transport_security' => [ // set to false to disable it 'enable' => true, 'value' => 'max-age=31536000', ], // set to true to add "www." prefix during redirection from http or already https 'add_www_prefix' => false, // remove existing "www." prefix during redirection from http or already https // only works if previous's config 'add_www_prefix' => false 'remove_www_prefix' => false, // Force Https for 404 pages 'allow_404' => true, ], // ... ];
3. Lastly, enable it
a. For Laminas Mvc application
// config/modules.config.php or config/application.config.php return [ 'Application', 'ForceHttpsModule', // register here ],
b. For Mezzio application
For mezzio-skeleton ^3.0, you need to open config/pipeline.php and add:
$app->pipe(ForceHttpsModule\Middleware\ForceHttps::class);
at the very first pipeline records.
Contributing
Contributions are very welcome. Please read CONTRIBUTING.md
samsonasik/force-https-module 适用场景与选型建议
samsonasik/force-https-module 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.05k 次下载、GitHub Stars 达 17, 最近一次更新时间为 2017 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「http」 「https」 「middleware」 「force」 「psr7」 「expressive」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 samsonasik/force-https-module 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 samsonasik/force-https-module 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 samsonasik/force-https-module 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
repository php library
A Laravel artisan based package to create the AWS (SES + SNS) infrastructure to receive email event notifications with Http/Https endpoint.
URL routing framework and requests/responses handler for PHP
Library implement an Online Certificate Status Protocol (OCSP) responder
Slim Framework 3 CSRF protection middleware utilities
统计信息
- 总下载量: 9.05k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 18
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-17