PHP code example of mistralys / ssl-switcher

1. Go to this page and download the library: Download mistralys/ssl-switcher library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mistralys / ssl-switcher example snippets


use Mistralys\SSLSwitcher;

SSLSwitcher::autoSwitch('https://domain.extension');

use Mistralys\SSLSwitcher;

$switcher = new SSLSwitcher('https://domain.extension');

// Is a switch to https );

use Mistralys\SSLSwitcher;

$switcher = new SSLSwitcher('https://domain.extension');
$switcher->setExitEnabled(false);
$switcher->switch();

// Handle the exit in the script instead
if($switcher->isSwitchRequired())
{
    exit();
}