PHPackages                             csun-metalab/laravel-force-https - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. csun-metalab/laravel-force-https

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

csun-metalab/laravel-force-https
================================

A small Composer package for Laravel 5.0 and above to force HTTPS in the URL

1.0.1(5y ago)06.3kMITPHPPHP &gt;=5.5.9

Since Jan 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/PioneeringTechLab/laravel-force-https)[ Packagist](https://packagist.org/packages/csun-metalab/laravel-force-https)[ RSS](/packages/csun-metalab-laravel-force-https/feed)WikiDiscussions dev Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

Laravel Force HTTPS Package
===========================

[](#laravel-force-https-package)

A small Composer package for Laravel 5.0 and above to force HTTPS in the URL via middleware.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
    - [Composer, Environment, and Service Provider](#composer-environment-and-service-provider)
        - [Composer](#composer)
        - [Environment](#environment)
        - [Service Provider](#service-provider)
    - [Middleware Installation](#middleware-installation)
    - [Publish Everything](#publish-everything)
- [Required Environment Variables](#required-environment-variables)
- [Middleware](#middleware)
    - [Force HTTPS Middleware](#force-https-middleware)
- [Resources](#resources)

Installation
------------

[](#installation)

### Composer, Environment, and Service Provider

[](#composer-environment-and-service-provider)

#### Composer

[](#composer)

To install from Composer, use the following command:

```
composer require csun-metalab/laravel-force-https

```

#### Environment

[](#environment)

Now, add the following line(s) to your `.env` file:

```
FORCE_HTTPS=true

```

This will enable the forcing functionality.

#### Service Provider

[](#service-provider)

Add the service provider to your `providers` array in `config/app.php` in Laravel as follows:

```
'providers' => [
   //...

   CSUNMetaLab\ForceHttps\Providers\ForceHttpsServiceProvider::class,

   // You can also use this based on Laravel convention:
   // 'CSUNMetaLab\ForceHttps\Providers\ForceHttpsServiceProvider',

   //...
],

```

### Middleware Installation

[](#middleware-installation)

Add the middleware to your `$middleware` array in `app/Http/Kernel.php` to apply it to all requests the application receives:

```
protected $middleware = [
	//...

	CSUNMetaLab\ForceHttps\Http\Middleware\ForceHttps::class,

	// You can also use this based on Laravel convention:
	// 'CSUNMetaLab\ForceHttps\Http\Middleware\ForceHttps',

	//...
];

```

### Publish Everything

[](#publish-everything)

Finally, run the following Artisan command to publish everything:

```
php artisan vendor:publish

```

The following assets are published:

- Configuration (tagged as `config`) - these go into your `config` directory

Required Environment Variables
------------------------------

[](#required-environment-variables)

You added an environment variable to your `.env` file that controls the protocol the application traffic uses.

### FORCE\_HTTPS

[](#force_https)

Whether to force HTTPS on all URLs or not. Default is `false` to prevent any unexpected issues from forcing HTTPS directly upon installation.

Middleware
----------

[](#middleware)

### Force HTTPS Middleware

[](#force-https-middleware)

This class is namespaced as `CSUNMetaLab\ForceHttps\Http\Middleware\ForceHttps`.

The middleware performs the following steps:

1. Checks to see if the application configuration requests traffic to be forced over HTTPS
2. If so, it performs the following steps:
    1. Resolves the request URI as an absolute URL so it can also see the protocol
    2. Checks to see if the `HTTPS` server variable is a non-empty value or set as `off`
    3. If the protocol isn't already `https:` then it replaces it with `https:` and returns a redirect
3. If not, it passes the request instance to the next configured middleware in the pipeline

Resources
---------

[](#resources)

### Middleware

[](#middleware-1)

- [Middleware in Laravel 5.0](https://laravel.com/docs/5.0/middleware)
- [Middleware in Laravel 5.1](https://laravel.com/docs/5.1/middleware)
- [Middleware in Laravel 5.2](https://laravel.com/docs/5.2/middleware)
- [Middleware in Laravel 5.3](https://laravel.com/docs/5.3/middleware)
- [Middleware in Laravel 5.4](https://laravel.com/docs/5.4/middleware)
- [Middleware in Laravel 5.5](https://laravel.com/docs/5.5/middleware)

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~924 days

Total

2

Last Release

2096d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef2f088dbe515e7505204053ba4b89fab631db23d7638297853dc697adf7ddc4?d=identicon)[matthewfritz](/maintainers/matthewfritz)

![](https://www.gravatar.com/avatar/5c86fd91fdf698dd5c9ceffd3dce175a6ae3000d00f4c00bf65b2e97f19072a1?d=identicon)[csun-metalab](/maintainers/csun-metalab)

![](https://www.gravatar.com/avatar/eb2e4b7e97c47122102e9eca3a2707f31d812f27d774197f62f27f130d128e49?d=identicon)[luisjg](/maintainers/luisjg)

---

Top Contributors

[![matthewfritz](https://avatars.githubusercontent.com/u/1715181?v=4)](https://github.com/matthewfritz "matthewfritz (6 commits)")[![luisjg](https://avatars.githubusercontent.com/u/16617588?v=4)](https://github.com/luisjg "luisjg (1 commits)")[![nercesk](https://avatars.githubusercontent.com/u/14825217?v=4)](https://github.com/nercesk "nercesk (1 commits)")

### Embed Badge

![Health badge](/badges/csun-metalab-laravel-force-https/health.svg)

```
[![Health](https://phpackages.com/badges/csun-metalab-laravel-force-https/health.svg)](https://phpackages.com/packages/csun-metalab-laravel-force-https)
```

###  Alternatives

[lexxyungcarter/chatmessenger

Simple one-to-one/group chat messaging tool for Laravel 5, 6, 7, 8, 9 &amp; 10 with Pusher Integration

10724.1k](/packages/lexxyungcarter-chatmessenger)[georgeboot/laravel-tiptap

Opinionated integration of Tiptap editor using the TALL stack

346.4k](/packages/georgeboot-laravel-tiptap)[bmichotte/dijkstra

php 7+ implementation of the Dijkstra algorithm

131.5k](/packages/bmichotte-dijkstra)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
