Create blockchain applications using the PHP programming language.
Learn more about the Enjin blockchain platform.
Sign up to Enjin Cloud: Kovan (Testnet), Mainnet (Production) or JumpNet.
This is a port from the official Java/C# SDKs with no support for async tasks and events (by design).
The Enjin PHP SDK requires at a minimum PHP7.
Simply clone this Git repository and use a PSR-4 Autoloader.
This example showcases how to quickly create and authenticate a client on the project schema which will then allow us to make further requests to the platform.
// Enjin Platform SDK for PHP
use Enjin\Sdk\EnjinHosts;
use Enjin\Sdk\ProjectClient;
use Enjin\Sdk\GraphQL\Request\Project;
use Enjin\Sdk\GraphQL\Request\Shared;
// Get the project client
$projectClient = new ProjectClient(EnjinHosts::KOVAN);
// Authenticate project
$accessToken = $projectClient->authProject(
(new Project\Query\AuthProject())
->setUuid('00000000-0000-0000-0000-000000000000')
->setSecret('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')
);
// Store the authentication token
if (null !== $accessToken) {
echo 'Client is now authenticated' . PHP_EOL;
$projectClient->auth($accessToken->getToken());
// Get gas prices
$gasPrices = $projectClient->getGasPrices(new Shared\Query\GetGasPrices());
}
Contributions to the SDK are appreciated!
You can open issues for bugs and enhancement requests.
If you make any changes or improvements to the SDK, which you believe are beneficial to others, consider making a pull request to merge your changes to be included in the next release.
Be sure to include your name in the list of contributors.
The license summary below may be copied.
Copyright 2021 Enjin Pte. Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.