{"id":15307261,"url":"https://github.com/samsonasik/forcehttpsmodule","last_synced_at":"2025-04-15T00:28:47.651Z","repository":{"id":46194579,"uuid":"79249165","full_name":"samsonasik/ForceHttpsModule","owner":"samsonasik","description":":link: Configurable module for force https in your Zend Framework/Laminas Mvc and ZF Expressive/Mezzio Application.","archived":false,"fork":false,"pushed_at":"2025-02-06T09:50:19.000Z","size":354,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T12:21:16.500Z","etag":null,"topics":["force-https","https","laminas","mezzio","php","psr-7","psr15","redirect","redirector","zend","zf2","zf3-mvc"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samsonasik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"samsonasik"}},"created_at":"2017-01-17T16:46:43.000Z","updated_at":"2025-02-06T09:50:23.000Z","dependencies_parsed_at":"2025-02-06T10:37:44.919Z","dependency_job_id":null,"html_url":"https://github.com/samsonasik/ForceHttpsModule","commit_stats":null,"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsonasik%2FForceHttpsModule","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsonasik%2FForceHttpsModule/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsonasik%2FForceHttpsModule/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samsonasik%2FForceHttpsModule/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samsonasik","download_url":"https://codeload.github.com/samsonasik/ForceHttpsModule/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248983254,"owners_count":21193543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["force-https","https","laminas","mezzio","php","psr-7","psr15","redirect","redirector","zend","zf2","zf3-mvc"],"created_at":"2024-10-01T08:09:39.864Z","updated_at":"2025-04-15T00:28:47.644Z","avatar_url":"https://github.com/samsonasik.png","language":"PHP","funding_links":["https://github.com/sponsors/samsonasik"],"categories":[],"sub_categories":[],"readme":"ForceHttpsModule\n================\n\n[![Latest Version](https://img.shields.io/github/release/samsonasik/ForceHttpsModule.svg?style=flat-square)](https://github.com/samsonasik/ForceHttpsModule/releases)\n![ci build](https://github.com/samsonasik/ForceHttpsModule/workflows/ci%20build/badge.svg)\n[![Code Coverage](https://codecov.io/gh/samsonasik/ForceHttpsModule/branch/master/graph/badge.svg)](https://codecov.io/gh/samsonasik/ForceHttpsModule)\n[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)\n[![Downloads](https://poser.pugx.org/samsonasik/force-https-module/downloads)](https://packagist.org/packages/samsonasik/force-https-module)\n\nIntroduction\n------------\n\nForceHttpsModule is a configurable module for force https in your [Laminas Mvc](https://docs.laminas.dev/tutorials/) and [Mezzio](https://docs.mezzio.dev/mezzio/) Application.\n\n\u003e This is README for version ^5.0 which only support Laminas Mvc version 3 and Mezzio version 3 with php ^8.2.\n\n\u003e For ^4.1.x, you can read at [version 4.1.x readme](https://github.com/samsonasik/ForceHttpsModule/blob/4.1.x/README.md) which only support Laminas Mvc version 3 and Mezzio version 3 with php ^7.4|~8.0\n\n\u003e For ~4.0.0, you can read at [version 4.0.x readme](https://github.com/samsonasik/ForceHttpsModule/blob/4.0.x/README.md) which only support Laminas Mvc version 3 and Mezzio version 3 with php ^7.3|~8.0\n\n\u003e For version ^3.0, you can read at [version 3 readme](https://github.com/samsonasik/ForceHttpsModule/tree/3.x.x) which only support Laminas Mvc version 3 and Mezzio version 3 with php ^7.1.\n\n\u003e For version ^2.0, you can read at [version 2 readme](https://github.com/samsonasik/ForceHttpsModule/tree/2.x.x) which only support ZF3 and ZF Expressive version 3 with php ^7.1.\n\n\u003e For version 1, you can read at [version 1 readme](https://github.com/samsonasik/ForceHttpsModule/tree/1.x.x) which still support ZF2 and ZF Expressive version 1 and 2 with php ^5.6|^7.0 support.\n\nFeatures\n--------\n\n- [x] Enable/disable force https.\n- [x] Force Https to All routes.\n- [x] Force Https to All routes except exclusion list.\n- [x] Force Https to specific routes only.\n- [x] Keep headers, request method, and request body.\n- [x] Enable/disable HTTP Strict Transport Security Header and set its value.\n- [x] Allow add `www.` prefix during redirection from http or already https.\n- [x] Allow remove `www.` prefix during redirection from http or already https.\n- [x] Force Https for 404 pages\n\nInstallation\n------------\n\n**1. Require this module uses [composer](https://getcomposer.org/).**\n\n```sh\ncomposer require samsonasik/force-https-module\n```\n\n**2. Copy config**\n\n***a. For [Laminas Mvc](https://docs.laminas.dev/tutorials/) application, copy `force-https-module.local.php.dist` config to your local's autoload and configure it***\n\n| source                                                                       | destination                                 |\n|------------------------------------------------------------------------------|---------------------------------------------|\n|  vendor/samsonasik/force-https-module/config/force-https-module.local.php.dist | config/autoload/force-https-module.local.php |\n\nOr run copy command:\n\n```sh\ncp vendor/samsonasik/force-https-module/config/force-https-module.local.php.dist config/autoload/force-https-module.local.php\n```\n\n***b. For [Mezzio](https://docs.mezzio.dev/mezzio/) application, copy `mezzio-force-https-module.local.php.dist` config to your local's autoload and configure it***\n\n| source                                                                       | destination                                 |\n|------------------------------------------------------------------------------|---------------------------------------------|\n|  vendor/samsonasik/force-https-module/config/mezzio-force-https-module.local.php.dist | config/autoload/mezzio-force-https-module.local.php |\n\nOr run copy command:\n\n```sh\ncp vendor/samsonasik/force-https-module/config/mezzio-force-https-module.local.php.dist config/autoload/mezzio-force-https-module.local.php\n```\n\nWhen done, you can modify your local config:\n\n```php\n\u003c?php\n// config/autoload/force-https-module.local.php or config/autoload/mezzio-force-https-module.local.php\nreturn [\n    'force-https-module' =\u003e [\n        'enable'                =\u003e true,\n        'force_all_routes'      =\u003e true,\n        'force_specific_routes' =\u003e [\n            // only works if previous's config 'force_all_routes' =\u003e false\n            'checkout',\n            'payment'\n        ],\n        'exclude_specific_routes' =\u003e [\n            // a lists of specific routes to not be https\n            // only works if previous config 'force_all_routes' =\u003e true\n            'non-https-route',\n        ],\n        // set HTTP Strict Transport Security Header\n        'strict_transport_security' =\u003e [\n            // set to false to disable it\n            'enable' =\u003e true,\n            'value'  =\u003e 'max-age=31536000',\n        ],\n        // set to true to add \"www.\" prefix during redirection from http or already https\n        'add_www_prefix'        =\u003e false,\n        // remove existing \"www.\" prefix during redirection from http or already https\n        // only works if previous's config 'add_www_prefix' =\u003e false\n        'remove_www_prefix'     =\u003e false,\n        // Force Https for 404 pages\n        'allow_404'             =\u003e true,\n    ],\n    // ...\n];\n```\n\n**3. Lastly, enable it**\n\n***a. For Laminas Mvc application***\n\n```php\n// config/modules.config.php or config/application.config.php\nreturn [\n    'Application'\n    'ForceHttpsModule', // register here\n],\n```\n\n***b. For Mezzio application***\n\nFor [mezzio-skeleton](https://github.com/mezzio/mezzio-skeleton) ^3.0, you need to open `config/pipeline.php` and add:\n\n```php\n$app-\u003epipe(ForceHttpsModule\\Middleware\\ForceHttps::class);\n```\n\nat the very first pipeline records.\n\nContributing\n------------\nContributions are very welcome. Please read [CONTRIBUTING.md](https://github.com/samsonasik/ForceHttpsModule/blob/master/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsonasik%2Fforcehttpsmodule","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamsonasik%2Fforcehttpsmodule","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamsonasik%2Fforcehttpsmodule/lists"}