nostrver-se / nostr-php

PHP helper library for Nostr https://nostr-php.dev
https://nostr-php.dev
MIT License
50 stars 15 forks source link

Support for older php versions #58

Closed im-adithya closed 3 months ago

im-adithya commented 3 months ago

First of all, thanks for building this 🙌

We are currently using this to build https://github.com/getAlby/nwc-php, which is inturn being used for https://github.com/getAlby/lightning-publisher-wordpress to add support for Nostr Wallet Connect payments in Wordpress.

To provide more flexibility to our plugin users, we're hoping to offer compatibility with older PHP versions, such as PHP 7.4 or PHP 8.0.

Would it be possible to consider downgrading the PHP requirement, or are there specific features in PHP 8.1 that are essential for the functionality of the library?

berkantkockaya commented 3 months ago

Hi, To solve the issue of supporting older PHP versions for the nostr-php library:

1.  Assess the code for any PHP 8.1 specific features being used.
2.  Identify and replace these features with alternatives compatible with PHP 7.4 or PHP 8.0.
3.  Update the composer.json file to reflect the lower PHP version requirement.
4.  Thoroughly test the library to ensure functionality is maintained with the older PHP versions.
Sebastix commented 3 months ago

@im-adithya Thanks, you're welcome!

Could you perhaps give some additional / contextual information why you can't upgrade to a maintained / security supported version of PHP? Both versions 7.4 and 8.0 are EOL and are considered to be unsafe with vulnerabilities.

AFAIK @fabianfabian is using a fork with >7.4 compability: https://github.com/fabianfabian/nostr-php

im-adithya commented 3 months ago

Thanks for the quick reply.

Could you perhaps give some additional / contextual information why you can't upgrade to a maintained / security supported version of PHP?

Not any specific reason per se but most people run an old version of php for Wordpress and we want to be able to offer our plugin support to many.

@fabianfabian is using a fork with >7.4 compability: https://github.com/fabianfabian/nostr-php

Awesome, will check it out. Thanks again 🙌

Sebastix commented 3 months ago

Tell them to upgrade ;-) Otherwise hosting providers will do. It's worth it to upgrade to 8.1+.

My goal with nostr-php is only to support the current maintained versions of PHP as all other major PHP frameworks do. I'm not a WordPress expert (and not a fan of it as well) but I assume WordPress is doing the same?

im-adithya commented 3 months ago

Tell them to upgrade ;-)

Yeah, have to at some point. Managing support for multiple versions is a pain

but I assume WordPress is doing the same?

Yup, they do, but with an (*) or (e) (Wordpress php compatibility)