Download the PHP package rootsoft/algorand-php without Composer

On this page you can find all versions of the php package rootsoft/algorand-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package algorand-php

algorand-php

Packagist Downloads Issues MIT License

Algorand is a public blockchain and protocol that aims to deliver decentralization, scale and security for all participants. Their PURE PROOF OF STAKE™ consensus mechanism ensures full participation, protection, and speed within a truly decentralized network. With blocks finalized in seconds, Algorand’s transaction throughput is on par with large payment and financial networks. And Algorand is the first blockchain to provide immediate transaction finality. No forking. No uncertainty.

Introduction

Algorand-php is a community SDK with an elegant approach to connect your application to the Algorand blockchain, send transactions, create assets and query the indexer with just a few lines of code.

Once installed, you can simply connect your application to the blockchain and start sending payments

or create a new asset:

Features

Getting started

Installation

Note: Algorand-php requires PHP 7.4+

You can install the package via composer:

Usage

Create an , and and pass them to the constructor. We added extra support for locally hosted nodes & third party services (like PureStake).

Laravel :heart:

We've added special support to make the life of a Laravel developer even more easy!

Publish the config file using:

Open the file in your project and insert your credentials

Now you can use the Facade!

Account Management

Accounts are entities on the Algorand blockchain associated with specific onchain data, like a balance. An Algorand Address is the identifier for an Algorand account. You can use the to perform all account related tasks.

Creating a new account

Creating a new account is as easy as calling:

With the given account, you can easily extract the public Algorand address, signing keys and seedphrase/mnemonic.

Loading an existing account

You can load an existing account using your generated secret key or binary seed.

Restoring an account

Recovering an account from your 25-word mnemonic/seedphrase can be done by passing an array or space delimited string

Transactions

There are multiple ways to create a transaction. We've included helper functions to make our life easier.

Or you can use the to create more specific, raw transactions:

Atomic Transfer

An Atomic Transfer means that transactions that are part of the transfer either all succeed or all fail. Atomic transfers allow complete strangers to trade assets without the need for a trusted intermediary, all while guaranteeing that each party will receive what they agreed to.

Atomic transfers enable use cases such as:

An atomic transfer can be created as following:

Asset Management

Create a new asset

Creating a new asset is as simple as using the included in the Algorand SDK:

Or as usual, you can use the to create your asset:

Edit an asset

After an asset has been created only the manager, reserve, freeze and clawback accounts can be changed. All other parameters are locked for the life of the asset.

If any of these addresses are set to "" that address will be cleared and can never be reset for the life of the asset. Only the manager account can make configuration changes and must authorize the transaction.

Destroy an asset

Opt in to receive an asset

Before being able to receive an asset, you should opt in An opt-in transaction is simply an asset transfer with an amount of 0, both to and from the account opting in. Assets can be transferred between accounts that have opted-in to receiving the asset.

Transfer an asset

Transfer an asset from the account to the receiver. Assets can be transferred between accounts that have opted-in to receiving the asset. These are analogous to standard payment transactions but for Algorand Standard Assets.

Freeze an asset

Freezing or unfreezing an asset requires a transaction that is signed by the freeze account.

Upon creation of an asset, you can specify a freeze address and a defaultfrozen state. If the defaultfrozen state is set to true the corresponding freeze address must issue unfreeze transactions, to allow trading of the asset to and from that account. This may be useful in situations that require holders of the asset to pass certain checks prior to ownership.

Revoking an asset

Revoking an asset for an account removes a specific number of the asset from the revoke target account. Revoking an asset from an account requires specifying an asset sender (the revoke target account) and an asset receiver (the account to transfer the funds back to).

Stateless Smart Contracts

Most Algorand transactions are authorized by a signature from a single account or a multisignature account. Algorand’s stateful smart contracts allow for a third type of signature using a Transaction Execution Approval Language (TEAL) program, called a logic signature (LogicSig). Stateless smart contracts provide two modes for TEAL logic to operate as a LogicSig, to create a contract account that functions similar to an escrow or to delegate signature authority to another account.

Contract Account

Contract accounts are great for setting up escrow style accounts where you want to limit withdrawals or you want to do periodic payments, etc. To spend from a contract account, create a transaction that will evaluate to True against the TEAL logic, then add the compiled TEAL code as its logic signature. It is worth noting that anyone can create and submit the transaction that spends from a contract account as long as they have the compiled TEAL contract to add as a logic signature.

Sample teal file

Account Delegation

Stateless smart contracts can also be used to delegate signatures, which means that a private key can sign a TEAL program and the resulting output can be used as a signature in transactions on behalf of the account associated with the private key. The owner of the delegated account can share this logic signature, allowing anyone to spend funds from his or her account according to the logic within the TEAL program.

Stateful Smart Contracts

Stateful smart contracts are contracts that live on the chain and are used to keep track of some form of global and/or local state for the contract. Stateful smart contracts form the backbone of applications that intend to run on the Algorand blockchain. Stateful smart contracts act similar to Algorand ASAs in that they have specific global values and per-user values.

Create a new application

Before creating a stateful smart contract, the code for the ApprovalProgram and the ClearStateProgram program should be written. The creator is the account that is creating the application and this transaction is signed by this account. The approval program and the clear state program should also be provided. The number of global and local byte slices (byte-array value) and integers also needs to be specified. These represent the absolute on-chain amount of space that the smart contract will use. Once set, these values can never be changed.

When the smart contract is created the network will return a unique ApplicationID. This ID can then be used to make ApplicationCall transactions to the smart contract.

Or you can build the raw transaction using the .

Opt into the Smart Contract

Before any account, including the creator of the smart contract, can begin to make Application Transaction calls that use local state, it must first opt into the smart contract. This prevents accounts from being spammed with smart contracts. To opt in, an ApplicationCall transaction of type OptIn needs to be signed and submitted by the account desiring to opt into the smart contract.

Or you can build the raw transaction using the .

Calling a Stateful Smart Contract

Once an account has opted into a stateful smart contract it can begin to make calls to the contract. Depending on the individual type of transaction as described in The Lifecycle of a Stateful Smart Contract, either the ApprovalProgram or the ClearStateProgram will be called. Generally, individual calls will supply application arguments. See Passing Arguments to a Smart Contract for details on passing arguments.

Or you can build the raw transaction using .

Update a Stateful Smart Contract

A stateful smart contract’s programs can be updated at any time. This is done by an ApplicationCall transaction type of UpdateApplication. This operation requires passing the new programs and specifying the application ID. The one caveat to this operation is that global or local state requirements for the smart contract can never be updated.

Or you can build the raw transaction using .

Delete a Stateful Smart Contract

To delete a smart contract, an ApplicationCall transaction of type DeleteApplication must be submitted to the blockchain. The ApprovalProgram handles this transaction type and if the call returns true the application will be deleted.

Close out

The user may discontinue use of the application by sending a close out transaction. This will remove the local state for this application from the user's account

Clear state

The user may clear the local state for an application at any time, even if the application was deleted by the creator. This method uses the same 3 parameter.

Multi Signatures

Multisignature accounts are a logical representation of an ordered set of addresses with a threshold and version. Multisignature accounts can perform the same operations as other accounts, including sending transactions and participating in consensus. The address for a multisignature account is essentially a hash of the ordered list of accounts, the threshold and version values. The threshold determines how many signatures are required to process any transaction from this multisignature account.

Create a multisignature address

Sign a transaction with a multisignature account

This section shows how to create, sign, and send a transaction from a multisig account.

Key Management Daemon

The Key Management Daemon (kmd) is a low level wallet and key management tool. It works in conjunction with algod and goal to keep secrets safe. kmd tries to ensure that secret keys never touch the disk unencrypted.

Note: If you are using a third-party API service, this process likely will not be available to you.

Check out the Algorand Developer documentation to learn more about the Key Management Daemon.

Indexer

Algorand provides a standalone daemon algorand-indexer that reads committed blocks from the Algorand blockchain and maintains a local database of transactions and accounts that are searchable and indexed.

The PHP SDK makes it really easy to search the ledger in a fluent api and enables application developers to perform rich and efficient queries on accounts, transactions, assets, and so forth.

At the moment we support queries on transactions, assets and accounts.

Transactions

Allow searching all transactions that have occurred on the blockchain.

Assets

Allow searching all assets that are created on the blockchain.

Accounts

Allow searching all accounts that are created on the blockchain.

Applications

Allow searching all applications on the blockchain.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing & Pull Requests

Feel free to send pull requests.

Please see CONTRIBUTING for details.

Questions?

Do you have any questions, join us at the official Algorand Discord!

Credits

License

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


All versions of algorand-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
ext-json Version *
brick/math Version ^0.9.3
guzzlehttp/guzzle Version ^7.4.1
guzzlehttp/psr7 Version ^1.8.2|^2.1.0
illuminate/container Version ^6.0|^7.0|^8.0|^9.0
illuminate/support Version ^6.0|^7.0|^8.0|^9.0
json-mapper/json-mapper Version ^2.12.0
myclabs/php-enum Version ^1.7
paragonie/constant_time_encoding Version ^2.4
paragonie/halite Version ^5.0.0
rybakit/msgpack Version ^0.7.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rootsoft/algorand-php contains the following files

Loading the files please wait ....