You've been able to install app updates automatically for some time now, but there was no way to install new system updates on your iPhone automatically. To get a new iOS version on your device, you'd go into the settings, then download the update. It would then either install right away or give you the option to install at nighttime. This whole process is easier in iOS 12.
Not mentioned at all in Apple's keynote at WWDC 2018, iOS 12 now sports an option to automatically install new iOS updates instead of always giving them the greenlight manually. For those of you who wait before updating to see if any major issues come out with other users, this likely won't be a setting you'll want to use. But if you don't mind jumping head first into a new update, this makes it easy.
To test it out, make sure you're running iOS 12. After installing iOS 12, before you can start using your iPhone again, you'll have to follow Apple's usual on-screen prompts about sending diagnostics and such, and there's a new one for "Keep Your iPhone Up to Date." Tap "Continue" there and you're all set, but if you chose "Install Updates Manually" and changed your mind, follow the steps below.
To manually change your update settings, open the Settings app, tap "General," followed by "Software Update." If you have any updates ready to be installed, they'll be shown here, just like before. But you'll also notice a new "Automatic Updates" option. Tap on that, then toggle the switch on (it's disabled by default).
Before any software automatically is installed, you'll get a notification telling you iOS is going to install it later on during the night. The update will only install, however, when connected to Wi-Fi and a power source. You'll probably have to enter your passcode when you pick up your iPhone afterward since it's needed after a restart anyway. Just note that your iPhone will be unusable for a few minutes while it installs the new iOS version, which means services like 911 will not be usable during that time.