Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

monstajamss's avatar

Get IP Address During Registration

I am trying to get IP address during registration and i did this

'ip_address' => $request->ip()

But it saves as 172.21.0.1 i would like to confirm if this because i am using sail/localhost because that is not my actual IP

Is it possible that when i deploy this application it will use the actual IP address?

Also is there a package to get Browser details and Machine details??

0 likes
3 replies
monstajamss's avatar

@Snapey So the package worked for knowing browser and machine details but i haven't seen any package for the IP though

Snapey's avatar

@monstajamss you get the ip direct from the request, s you had been doing

remember

  • all the people in the same office will have the same ip
  • all the family in one house will have the same ip
  • people connecting via mobile networks will have a different ip every time
  • people might connect from home today, coffeeshop tomorrow
  • they might be on an ipv6 network
2 likes

Please or to participate in this conversation.