There really is no good way to keep all your music available and save space on your iPhone at the same time. iCloud is a syncing feature and not simply offline storage. Apple solutions such as iCloud Music Library & Apple Music will not help you free up space on your iPhone (as far as Music goes):
Turn on iCloud Music Library - Apple Support
Access your music collection on all of your devices with Apple Music - Apple Support
If this is music you purchased from the iTunes Store, you can delete the songs you don't want right now and re-download them later:
Redownload apps, music, movies, TV shows, and books from the iTunes Store, iBooks Store, and App Store - Apple Support
If you have a lot of photos, you can use iCloud Photo Library to free up some space on your iPhone. See the "Save space on your device" section in:
iCloud Photo Library - Apple Support