Do Apple stores refuse to repair your iPhone if not purchased directly from Apple? I am planning to buy an iPhone 6 from an online store. But I have been told that if I buy from anywhere except the Apple store, I won't be able to enjoy the benefits of the warranty and guarantee. Is that true?
You can research Apple's warranty at http://apple.com/legal

You will have consumer law protections if you can prove you purchased product in a certain place. Those trump any warranty.

Apple's warranty is attached to the phone (or any serialized product), so all that matters is what country that serial number was first sold as Apple's records show. They then warrant that one device under that one legal framework.

The warranty doesn't need proof of purchase, but most of the agreements I've read say "Apple or its agents may require that you furnish proof of purchase details" which protects them against stolen or counterfeit serial numbers if there is doubt.

I would recommend you get a written invoice with the business name and the serial number of the iPhone so you are covered in case Apple exercises the "may require" clause, but I've never heard of anyone actually reporting that they needed to provide proof of purchase as Apple typically honors their warranty to the letter and often treats consumers better than the warranty allows.