Porting one function from php to elixir

I’d probably just embed a small php script in the elixir project and drive it with System.cmd or a port to encode data to something elixir understands and then reencode in a format more suited to elixir. Add some metric collection to see how often the fallback to php is actually needed and once it’s low enough you can pull the php script from use.