Before you start, make sure you have:
Both devices (your pc/laptop and your phone/other device) connected to the same Wi-Fi network
Step 1: Find Your Local IP Address
Open your terminal and run this command:
ipconfig getifaddr en0
This returns something like: 192.168.29.247
This is your local IP address — other devices on the same network can use this to reach your system.
Step 2: Serve Laravel Using PHP’s Built-In Server
Navigate to your Laravel project root folder:
cd path/to/your-laravel-project
Then run the following command:
php -S 192.168.29.247:8080 -t public
Note:
- php -S starts the built-in PHP server
- 192.168.29.247 is your system IP address
- 8080 is the port (you can use another, like 8000)
- -t public tells PHP to serve files from Laravel’s public/ folder
You should now see something like:
PHP 8.x Development Server started at http://192.168.29.247:8080
Step 3: Access the App from Another Device
On your phone or another computer connected to the same Wi-Fi, open a browser and go to:
http://192.168.29.247:8080
Now your Laravel app running.
Optional: Adjust Firewall Settings (If Needed)
If you're unable to access the app from another device:
- Go to System Firewall Settings
- Ensure incoming connections are allowed for Terminal or PHP
Top comments (0)