u01jmg3 / ics-parser

Parser for iCalendar Events • PHP 8+, 7 (≥ 7.4), 5 (≥ 5.6)
MIT License
439 stars 144 forks source link

Decouple file download from "file" call #303

Closed lochmueller closed 4 months ago

lochmueller commented 2 years ago

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

u01jmg3 commented 2 years ago

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 commented 4 months ago

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