I am trying make an application that uses the ethernet cable to communicate to another slave device using modbus tcp/ip protocol. I was unable find any library that did that using the enc28j60
Why did you choose the ESP32 if you want to connect to the slave device by Ethernet cable? The ESP32 has an Ethernet MAC on-chip, so theoretically you only need an external PHY to get Ethernet capabilities..
UIPEthernet should work although I never tested that myself.