What's the relationship between homebrew and xcode command line tools？ Are they the same thing? 

I was reading the "homebrew-php" github page, and it mentions about xcode and its command line tools. 
My understanding about homebrew is it is a package manager like npm, why does it have anything to do with xcode, which I think doesn't have much to do with PHP.
Homebrew doesn't include a compiler and other tools that would duplicate Apple's development tools. Instead of that - it just asks for you to get the basic tools from Apple.

Xcode uses the same tools under the hood as homebrew - so you could satisfy this specific requirement either by installing the command line tools directly or via an Xcode install.

So, they aren't the same thing and you need both for the brew package manager to run.