Below is the encryption method written in java, which I am trying to convert in php.
public static String encryptWithAesCtrNoPadding(final String key, final Strin