PHPackages                             jeremykenedy/laravel-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. jeremykenedy/laravel-https

ActiveLibrary

jeremykenedy/laravel-https
==========================

Laravel Https is middleware to check for Secure HTTP requests. Laravel Https middleware providers can check and redirect if the user is not hitting the https url of your app/site or the request can be automatically redirected to a Secure Http (HTTPS) request.

v2.0.0(3y ago)36133.5k↓35.1%5MITPHPPHP ^7.2|^8.0|^8.1|^8.2|^8.3

Since Nov 12Pushed 3y ago3 watchersCompare

[ Source](https://github.com/jeremykenedy/laravel-https)[ Packagist](https://packagist.org/packages/jeremykenedy/laravel-https)[ GitHub Sponsors](https://github.com/jeremykenedy)[ Patreon](https://www.patreon.com/jeremykenedy)[ RSS](/packages/jeremykenedy-laravel-https/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)DependenciesVersions (13)Used By (0)

[![Laravel Https ](https://camo.githubusercontent.com/96eebf1581301e348d3681000eca38316f3eaaaef7fb70578bcf909c6c08b8b2/68747470733a2f2f6769746875622d70726f6a6563742d696d616765732e73332d75732d776573742d322e616d617a6f6e6177732e636f6d2f6c6f676f732f6c61726176656c2d68747470732d6c6f676f2e706e67)](https://camo.githubusercontent.com/96eebf1581301e348d3681000eca38316f3eaaaef7fb70578bcf909c6c08b8b2/68747470733a2f2f6769746875622d70726f6a6563742d696d616765732e73332d75732d776573742d322e616d617a6f6e6177732e636f6d2f6c6f676f732f6c61726176656c2d68747470732d6c6f676f2e706e67)

Laravel HTTPS Web and API Checker
=================================

[](#laravel-https-web-and-api-checker)

Laravel Https is middleware to check for Secure HTTP requests. Laravel Https has can check for HTTPS and throw an error or automatically redirect to HTTPS.

[![Latest Stable Version](https://camo.githubusercontent.com/81756c5f8b5621efe0519c2a02910c3ea88f7c64fc5c6a678c37c3bfffa8f12b/68747470733a2f2f706f7365722e707567782e6f72672f6a6572656d796b656e6564792f6c61726176656c2d68747470732f762f737461626c65)](https://packagist.org/packages/jeremykenedy/laravel-https)[![Total Downloads](https://camo.githubusercontent.com/7348a6c35114484e3082fb1297268e3dbc272ebb42e4850946c15e5a60ed9171/68747470733a2f2f706f7365722e707567782e6f72672f6a6572656d796b656e6564792f6c61726176656c2d68747470732f646f776e6c6f616473)](https://packagist.org/packages/jeremykenedy/laravel-https)[![StyleCI](https://camo.githubusercontent.com/8d683ab5a0106d74979d16f06adf9f124e5cbd187256c56d1359cbd874e4f6ea/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3131303432353836372f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/110425867)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

- [About](#about)
- [Features](#features)
- [Requirements](#requirements)
- [Installation Instructions](#installation-instructions)
- [Configuration](#configuration)
    - [Environment File](#environment-file)
- [Usage](#usage)
    - [From Route File](#from-route-file)
        - [Route Group Example](#route-group-example)
        - [Individual Route Examples](#individual-route-examples)
    - [From Controller File](#from-controller-file)
        - [Controller File Example](#controller-file-example)
- [Screenshots](#screenshots)
- [File Tree](#file-tree)
- [Opening an Issue](#opening-an-issue)
- [License](#license)

### Features

[](#features)

laravel-https Features`forceHTTPS` middlware to check if URL is HTTPS and redirect to HTTPS if not.`checkHTTPS` middlware to check if URL is HTTPS and throw an error if not.Each middleware can be used in individual controllers constructorEach middleware can be used as a middleware on individual routesEach middleware can be used as a middleware route groupReturns HTML for HTTP requestsReturns JSON for API requestsUses localized language files### Requirements

[](#requirements)

- [Laravel 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 6, 7, 8, 9, 10+](https://laravel.com/docs/installation)

### Installation Instructions

[](#installation-instructions)

1. From your projects root folder in terminal run:

    ```
        composer require jeremykenedy/laravel-https
    ```
2. Register the package

    - Laravel 5.5 and up Uses package auto discovery feature, no need to edit the `config/app.php` file.
    - Laravel 5.4 and below Register the package with laravel in `config/app.php` under `providers` with the following:

    ```
        'providers' => [
        ...
            jeremykenedy\LaravelHttps\LaravelHttpsServiceProvider::class,
        ];
    ```
3. Optionally publish the packages views, config file, and language files by running the following from your projects root folder:

    ```
        php artisan vendor:publish --tag=LaravelHttps
    ```
4. Add the middleware to your routes or controller. See [Usage](#usage).

### Configuration

[](#configuration)

laravel-https can be configured in directly in `/config/laravel-https.php` if you published the assets. Or you can variables to your `.env` file.

##### Environment File

[](#environment-file)

Here are the `.env` file variables available:

```
LARAVEL_HTTP_ERROR_CODE=403
```

### Usage

[](#usage)

##### From Route File:

[](#from-route-file)

- You can include the `checkHTTPS` or `forceHTTPS` in a route groups or on individual routes.

###### Route Group Example:

[](#route-group-example)

```
    Route::group(['middleware' => ['web', 'checkHTTPS']], function () {
        Route::get('/', 'WelcomeController@welcome');
    });
```

###### Individual Route Examples:

[](#individual-route-examples)

```
    Route::get('/', 'WelcomeController@welcome')->middleware('checkHTTPS');
    Route::match(['post'], '/test', 'Testing\TestingController@runTest')->middleware('forceHTTPS');
```

##### From Controller File:

[](#from-controller-file)

- You can include the `checkHTTPS` or `forceHTTPS` in the contructor of your controller file.

###### Controller File Example:

[](#controller-file-example)

```
    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
       $this->middleware('forceHTTPS');
    }
```

### Screenshots

[](#screenshots)

[![Http Middleware checkHTTPS](https://camo.githubusercontent.com/0a859bcb03d0a03852b7d284ff5ab4f3d7d5e4cd45b3577b0c422676e46f8f1a/68747470733a2f2f73332d75732d776573742d322e616d617a6f6e6177732e636f6d2f6769746875622d70726f6a6563742d696d616765732f6c61726176656c2d68747470732f312d687474702d63616c6c2e6a7067)](https://camo.githubusercontent.com/0a859bcb03d0a03852b7d284ff5ab4f3d7d5e4cd45b3577b0c422676e46f8f1a/68747470733a2f2f73332d75732d776573742d322e616d617a6f6e6177732e636f6d2f6769746875622d70726f6a6563742d696d616765732f6c61726176656c2d68747470732f312d687474702d63616c6c2e6a7067)[![API Middleware checkHTTPS](https://camo.githubusercontent.com/46762db237e860a8a48219e27bfb2f70a9a671dc20fecd6b175efdbbeb9af77c/68747470733a2f2f73332d75732d776573742d322e616d617a6f6e6177732e636f6d2f6769746875622d70726f6a6563742d696d616765732f6c61726176656c2d68747470732f322d6170692d63616c6c2e6a7067)](https://camo.githubusercontent.com/46762db237e860a8a48219e27bfb2f70a9a671dc20fecd6b175efdbbeb9af77c/68747470733a2f2f73332d75732d776573742d322e616d617a6f6e6177732e636f6d2f6769746875622d70726f6a6563742d696d616765732f6c61726176656c2d68747470732f322d6170692d63616c6c2e6a7067)

### File Tree

[](#file-tree)

```
├── .gitignore
├── LICENSE
├── README.md
├── composer.json
└── src
    ├── LaravelHttpsServiceProvider.php
    ├── app
    │   └── Http
    │       └── Middleware
    │           ├── CheckHTTPS.php
    │           └── ForceHTTPS.php
    ├── config
    │   └── laravel-https.php
    └── resources
        ├── lang
        │   └── en
        │       └── laravel-https.php
        └── views
            └── errors
                └── 403.blade.php
```

- Tree command can be installed using brew: `brew install tree`
- File tree generated using command `tree -a -I '.git|node_modules|vendor|storage|tests'`

### Opening an Issue

[](#opening-an-issue)

Before opening an issue there are a couple of considerations:

- You are all awesome!
- **Read the instructions** and make sure all steps were *followed correctly*.
- **Check** that the issue is not *specific to your development environment* setup.
- **Provide** *duplication steps*.
- **Attempt to look into the issue**, and if you *have a solution, make a pull request*.
- **Show that you have made an attempt** to *look into the issue*.
- **Check** to see if the issue you are *reporting is a duplicate* of a previous reported issue.
- **Following these instructions show me that you have tried.**
- If you have a questions send me an email to
- Need some help, I can do my best on Slack:
- Please be considerate that this is an open source project that I provide to the community for FREE when openeing an issue.

Open source projects are a the community’s responsibility to use, contribute, and debug.

### License

[](#license)

Laravel-https is licensed under the MIT license. Enjoy!

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity42

Moderate usage in the ecosystem

Community14

Small or concentrated contributor base

Maturity85

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 92.9% 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 ~276 days

Recently: every ~252 days

Total

8

Last Release

1177d ago

Major Versions

v1.5.0 → v2.0.02023-02-26

PHP version history (4 changes)v1.0.1PHP &gt;=5.4.0

v1.3.0PHP ^7.2

v1.4.0PHP ^7.2|^8.0

v2.0.0PHP ^7.2|^8.0|^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/05cef7d9ee65723b129042943511207fb34db74a56afbf67b5900987f758c161?d=identicon)[jeremykenedy](/maintainers/jeremykenedy)

---

Top Contributors

[![jeremykenedy](https://avatars.githubusercontent.com/u/6244570?v=4)](https://github.com/jeremykenedy "jeremykenedy (26 commits)")[![area-sviluppo](https://avatars.githubusercontent.com/u/164878026?v=4)](https://github.com/area-sviluppo "area-sviluppo (1 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

---

Tags

httpsLaravel HttpsSecure HttpHTTPS Middleware

### Embed Badge

![Health badge](/badges/jeremykenedy-laravel-https/health.svg)

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

###  Alternatives

[league/uri

URI manipulation library

1.1k206.4M277](/packages/league-uri)[league/uri-interfaces

Common tools for parsing and resolving RFC3987/RFC3986 URI

536204.9M23](/packages/league-uri-interfaces)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[mashape/unirest-php

Unirest PHP

1.3k9.7M161](/packages/mashape-unirest-php)[bepsvpt/secure-headers

Add security related headers to HTTP response. The package includes Service Providers for easy Laravel integration.

5484.7M9](/packages/bepsvpt-secure-headers)[padraic/humbug_get_contents

Secure wrapper for accessing HTTPS resources with file\_get\_contents for PHP 5.3+

1255.3M5](/packages/padraic-humbug-get-contents)

PHPackages © 2026

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