You can use an Apple Wireless Keyboard (available separately) for typing on iPhone. The Apple Wireless Keyboard connects via Bluetooth.

Once the keyboard is paired with iPhone, it connects whenever the keyboard is within range (up to 30 feet). You can tell that the keyboard is connected if the onscreen keyboard doesn’t appear when you tap in a text field. To save the battery, turn off or unpair the keyboard when not in use.