#!/usr/bin/env python3
"""Helper to write PHP files without BOM encoding issues."""
import sys
import os

def write_php(filepath, content):
    """Write content to filepath without BOM."""
    os.makedirs(os.path.dirname(filepath), exist_ok=True)
    with open(filepath, 'w', encoding='utf-8', newline='\n') as f:
        f.write(content)

if __name__ == '__main__':
    filepath = sys.argv[1]
    content = sys.stdin.read()
    write_php(filepath, content)
    print(f"Written: {filepath}")
