ics-parser icon indicating copy to clipboard operation
ics-parser copied to clipboard

Decouple file download from "file" call

Open lochmueller opened this issue 2 years ago • 1 comments

Hey everyone,

great parser, and thank you for development. I have problem using file to download external resources by PHP configuration allow_url_fopen=0. Do you think about decouple the download logic from PHP internal file function? Some ideas...

  1. Move the fileOrUrl function to a separate class for easier handling/overwriting/patching this class for external developer
  2. Or using a widespread lib like Guzzle to handle the download to support multiple download options (curl, file, custom handler)
  3. Or using a interface based HTTP client abstraction like https://docs.php-http.org/en/latest/httplug/library-developers.html to develop against an interface (fallback could be your current function), so consumers of your lib could add the adapter-client of their choice without touching/patching you lib.

Regards, Tim

lochmueller avatar Mar 10 '22 07:03 lochmueller

Hi Tim, happy for you to take this forwards and develop a PR for @s0600204 and I to take a look at. I think option 1 is likely the best option.

u01jmg3 avatar Mar 10 '22 10:03 u01jmg3

Please feel free to reopen if/when you'd like to submit a PR.

u01jmg3 avatar Mar 08 '24 16:03 u01jmg3