WiFi communication

I am trying to find the best way to go about connecting my arduino nano v3.0 or pro mini 5v to the internet. I want to be able to send commands to them over wifi, and I am looking at the ESP8266. Is this a feasible way to go about this? I just need to control about 3 or 4 I/O pins on the boards, but I haven't been able to find anything similar online anywhere. Any ideas on how to go about this? Any help is greatly appreciated.

Thanks!

Try the NodeMCU breakouts you can get - Makes using ESP8266 really easy (There are other good breakouts but these are the ones i use because they are cheap and work really well)

They only have like 8 digital IO but they have a load of processing power and lots of web examples of connecting to wifi

I also wrote this tutorial for sending data in binary format over wiFi Tutorial

Note that for this sort of project, the ESP8266 is used instead of an Arduino.