Send your laravel apps to the moon with web3 enabled π
sawirricardo/laravel-web3 is a Laravel package for send your laravel apps to the moon with web3 enabled π.
It currently has 21 GitHub stars and 392 downloads on Packagist (latest version 1.0.0).
Install it with composer require sawirricardo/laravel-web3.
Discover more Laravel packages by sawirricardo
or browse all Laravel packages to compare alternatives.
Last updated
Laravel Web3 helps you to kickstart your web3 apps.
Investing on Laravel-Web3 is defintely a good move from you. You can support by donating to my wallet
You can install the package via composer:
composer require sawirricardo/laravel-web3
You can publish and run the migrations with:
php artisan vendor:publish --provider="Sawirricardo\LaravelWeb3\LaravelWeb3ServiceProvider" --tag="laravel-web3-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --provider="Sawirricardo\LaravelWeb3\LaravelWeb3ServiceProvider" --tag="laravel-web3-config"
This is the contents of the published config file:
return [
'network' => env('WEB3_NETWORK', 'localhost'),
'infura_id' => env('WEB3_INFURA_ID', ''),
];
Add this to your .env
WEB3_NETWORK=localhost #mainnet, mumbai, etc
WEB_INFURA_ID=xxxxxxxxxxxxxxxxxx
MIX_WEB3_NETWORK="${WEB3_NETWORK}"
MIX_WEB3_INFURA_ID="${WEB_INFURA_ID}"
Then, add "account" to \App\Models\User fillables
// app/Models/User.php
protected $fillable = [
'email','name','password',
'account' //Add this
];
Also add this to your layout HTML
<body>
<!-- it's best to drop this at the below -->
<script
src="https://cdn.ethers.io/lib/ethers-5.2.umd.min.js"
type="application/javascript"
></script>
<script
type="text/javascript"
src="https://unpkg.com/[email protected]/dist/index.js"
></script>
<script
type="text/javascript"
src="https://unpkg.com/@walletconnect/[email protected]/dist/umd/index.min.js"
></script>
<x-laravelweb3Scripts />
</body>
@guest
<button onclick="laravelWeb3.onConnect()">Connect to wallet</button>
@endguest
@auth
<button onclick="laravelWeb3.onDisconnect()">Disconnect wallet</button>
@endauth
// return provider object by Ethers JS
// Run wild, my friends
const etherProvider = laravelWeb3.getProvider();
// LaravelWeb3 automatically register laravelWeb3 to window object for you to play.
console.log({window.laravelWeb3});
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.