Skip to main content

NGROK for Laravel

Share Your Local PHP/Laravel using Ngrok



This post shows how to share your Laravel Framework Installation on Ubuntu but you can perform the same with other operating systems as well.

What is Ngrok

ngrok is a simplified API-first ingress-as-a-service that adds connectivity,security, and observability to your apps in one line.It allows you to create a tunnel very fast for free and Laravel has an internal webserver that can be used without configuration.

Why Ngrok

Ngrok allows developers to expose their locally hosted applications to the internet, which is useful for testing and debugging purposes. It eliminates the need to deploy the application to a remote server for testing, saving time and effort.Mostly Ngrok is used where we need to test webhook locally.Ngrok enables developers to receive these webhooks on their local machine, facilitating the development and testing of webhook-based functionality.
How to use Ngrok
Assuming you have Laravel installed correctly, you can follow the steps below to use Ngrok: 1. Download Ngrok: Visit the official Ngrok website (download link) and download the version compatible with your operating system. 2. Sign up and get an authentication token: Create an account on the Ngrok website and obtain your authentication token. This token will be used to authenticate your Ngrok client. 3. Extract the Ngrok executable: Choose a directory on your computer and extract the downloaded Ngrok executable to that location. 4. Connect your account: Open a terminal or command prompt and navigate to the directory where you extracted the Ngrok executable. Connect your Ngrok client to your account by running the following command: ngrok authtoken YOUR_AUTH_TOKEN Replace `YOUR_AUTH_TOKEN` with the authentication token obtained from the Ngrok website. 5. Start a tunnel: To expose your local Laravel server, run the following command:
ngrok http 8000
6. Access the tunnel: Once the command is executed, Ngrok will generate a temporary public URL for accessing your local Laravel server. It will display the forwarding URLs in the terminal or command prompt. The URL will typically have the format `http://random_string.ngrok.io`.
You can now use the provided Ngrok URL to access your local Laravel server from anywhere on the internet. Remember to manually stop Ngrok by pressing Ctrl+C in the terminal or command prompt when you no longer need the tunnel. These steps assume you have Laravel correctly installed, and Ngrok provides additional features and customization options that you can explore by referring to the Ngrok documentation.


Comments

Popular posts from this blog

When Should Developers Use AI to Plan vs Just Start Coding?

When and How Should Developers Use AI — Plan First or Start Generating Code? Last week, a developer on our team opened an AI tool before writing a single line of code. The task? Change a button label. A few minutes later, the AI had suggested architecture improvements, refactoring strategies, testing layers, and performance considerations… for a one-line change. We laughed. But it revealed something important: Using AI isn’t the challenge anymore. Knowing  when and how  to use it is. The Real Decision: Generate Code or Think First? Today, developers face a new daily choice: Should I ask AI to generate code right away… or should I use AI to help me plan first? Starting with code feels fast. It gives you that dopamine hit of "done." But without clarity, rapid generation often leads to rework, hidden bugs, and "spaghetti code" that just happens to be syntax-perfect. Great developers use AI differently. They decide  whether the problem needs thinking or typing . A memor...

Securing Your Emails: A Simple Guide to Email Authentication and Best Practices

Email security is crucial in today's digital landscape, and implementing authentication measures like DMARC, SPF, and DKIM can go a long way in safeguarding your domain. Here's an easy-to-follow guide to ensure your emails are authenticated and delivered securely: 1. Implement DMARC, SPF, and DKIM: Follow these steps for popular email services: Postmark Refer to the instructions provided in this link SendGrid Check the relevant information on their platform. Mailchimp Follow the recommended steps on their platform. 2. Validate Forward and Reverse DNS Records: Make sure your sending domains or IPs have valid forward and reverse DNS records (PTR records). Check resources for each service: Postmark Provides coverage for this aspect. SendGrid  Find the necessary information here Mailchimp Follow the guidelines specified by Mailchimp. 3. Maintain Low Spam Rates: Keep spam rates below 0.3% in Postmaster Tools and consider configuring Google Postmaster for additional insights into...

Complete guide: integrating POSTGIS with Laravel

PostGIS - It is an open-source software extension for the PostgreSQL relational database management system. It enables support for geographic objects and spatial queries, making it a powerful tool for working with geographic information systems (GIS) data. PostGIS allows you to store, manipulate, and analyze spatial data, such as points, lines, polygons, and other geometric objects. How to Setup PostGIS with Laravel To set up PostGIS with Laravel, you'll need to follow a few steps. PostGIS is an extension for PostgreSQL that allows you to work with geospatial data, and Laravel is a popular PHP framework. Before proceeding, ensure you have PostgreSQL installed on your server or local development environment. Here's a step-by-step guide to setting up PostGIS with Laravel: 1. Install Laravel: If you haven't already, install Laravel using Composer. Open your terminal and run the following command: composer create-project --prefer-dist laravel/laravel project-name 2. Configure...