indentation is a PHP library to detect and manipulate the indentation of files and strings.
Point it at a file and it’ll tell you whether that file uses tabs or spaces and how many of them. From there you can convert between styles, add leading indentation to every line (handy for embedding code samples into Markdown), or strip the common indentation back off again.