Laravel php artisan serve to mimic HTTPS
You can use ngrok
for that
php artisan servecd <path-to-ngrok>./ngrok http localhost:8000
Laravel uses the in-built PHP5.4 development server php -S
(http://php.net/manual/en/features.commandline.webserver.php) for it's artisan serve
command (see Illuminate\Foundation\Console\ServeCommand
). This only supports plain HTTP, so no, this isn't possible. Your best bet would be to use a Vagrant box set up to work with SSL/TLS.
If you're using xampp, then you can setup HTTPS locally with xampp (this post is also useful for setting up HTTPS) and then you can:
move your project to
htdocs
folder and visit it withhttps://localhost/projectFolder/public/
or just create a special
VirtualHost
inhttpd-vhosts.conf
for this project (always point to thatpublic
folder, this is from where the project is running) and then visit it withhttps://localhost/
in this example (you can of course, run it on a subdomain if you want to)<VirtualHost *:80> ServerName localhost DocumentRoot "c:\pathToYourProject\projectFolder\public" <Directory "c:\pathToYourProject\projectFolder\public"> Options All AllowOverride All </Directory></VirtualHost># this should ensure https (this is mentioned in the stackoverflow post, that I linked as useful<VirtualHost *:443> ServerName localhost DocumentRoot "c:\pathToYourProject\projectFolder\public" SSLEngine on SSLCertificateFile "conf\ssl.crt\server.crt" SSLCertificateKeyFile "conf\ssl.key\server.key" <Directory "c:\pathToYourProject\projectFolder\public"> Options All AllowOverride All </Directory></VirtualHost>
Theoretically, when you're using this method, you don't even need php artisan serve
(tbh I'm not entirely sure if it has any purpose in this case).