monero-integrations / monerophp

Monero PHP library + JsonRPC Client
MIT License
116 stars 76 forks source link

Porting to PHP 8 and rewrite #124

Open cypherbits opened 3 years ago

cypherbits commented 3 years ago

Hi, just to tell you I'm working on porting this to PHP8, using strict types and replace custom classes ( like sha3, ed25519 or base58 ) with mature php projects using strict types.

serhack commented 3 years ago

That's great! Feel free to create a PR! (or create it now with WIP tag, so I could have a look at it 😄 ).

cypherbits commented 3 years ago

You can see it here https://github.com/cypherbits/monerophp/tree/new-generation-php8

It is early development. I deleted SHA3, ed25519 and Base58 classes since there are better and more modern projects...

I'm working on the WalletRPC at the moment and I created some classes like TransferAmount and TransferDestination to make it easy to define things...

Maybe we should make an "easy to use" Monero RPC based fully on classes like Paypal or Stripe too... IDK.

For example to define a transfer destination now you can do:

$destination = TransferDestination::create('0.0015654', TransferAmount::$TYPE_MONERO, 'address');

or create independent Amount like:

$amount = new TransferAmount('1321321654', TransferAmount::$TYPE_PICONERO);
or
$amount = new TransferAmount('0.0015654', TransferAmount::$TYPE_MONERO);

I'm removing old support like making transfers with PaymentIds (they are not on the RPC specification anymore...) or defining some inputs we didn't have yet...

What do you think?

aguevaraIL commented 3 years ago

Why is it now following PSR12 standard?

cypherbits commented 3 years ago

I'm working on my fork: https://github.com/cypherbits/monerophp/tree/new-generation-php8

I'm already half-done with jsonRPCclient and the wallet rpc.

Do we really need a PHP implementation of:

I understand we needed sha3 and ed25519 for cryptonote, in the past. Could we use PHP sodium and sha3 functions now? Or we cannot? I need help with this work...