superciety/elrond-sdk-laravel

This package is abandoned and no longer maintained. The author suggests using the mx-sdk-php package instead.

MultiversX SDK for Laravel (written in PHP).

v2.3.0 2024-11-04 13:41 UTC

README

Latest Version on Packagist GitHub Tests Action Status Total Downloads

This SDK is a wrapper around the native mx-sdk-php to enable out-of-the-box support for Laravel applications.

Additionally, it comes with pre-configured MultiversX API Network Providers including caching mechanisms using the default Laravel cache driver.

Installation

You can install the package via composer:

composer require peerme/mx-sdk-laravel

And publish the config file config/multiversx.php via

php artisan vendor:publish --provider="MultiversX\ServiceProvider" --tag="config"

Usage

Since this package wraps & configures the native packages for Laravel, you can access their utitlies without further configurations.

This includes:

  • User Login Signature Verification
  • MultiversX constants
  • Domain Objects
  • Blockchain-specific constants
  • Other Utitilies & more

For more details, please refer to their documentation:

Calling the API

When instantiating the Network Providers, you can decide to optionally cache responses:

use MultiversX\Multiversx;

// retrieve fresh responses each time
$api = Multiversx::api();

// or retrieve cached responses subsequently for 1 hour
$api = Multiversx::apiWithCache(expiresAt: now()->addHour());

Validation Rules

This package exposes the following Laravel Validation Rules.

MxAddressRule – to validate a given address format:

[
    'address' => ['required', new MxAddressRule],
]

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.