Skip to content

Commit a879b4d

Browse files
committed
Enhanced PHP documentation
- Fixed a broken link in the Japanese docs
1 parent 4e6ae75 commit a879b4d

File tree

17 files changed

+381
-62
lines changed

17 files changed

+381
-62
lines changed

@l10n/ja/docs/concepts/tokens/fungible-tokens/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ labels:
1616

1717
トラストラインとは、XRP Ledgerにおける[トークン](../index.md)を保持するための仕組みを指します。トラストラインは、XRP Ledgerのルールである「不要なトークンを他者に保有させることはできない」という原則を強制するものです。この制限は、XRP Ledgerのユースケースである[コミュニティクレジット](../index.md#コミュニティクレジット)などを実現するために不可欠なものです。
1818

19-
トラストラインは[RippleState](../../references/protocol/ledger-data/ledger-entry-types/ripplestate)オブジェクトとして定義されます。それぞれのトラストラインは、以下のような _双方向_ の関係から成り立っています。
19+
トラストラインは[RippleState](/docs/references/protocol/ledger-data/ledger-entry-types/ripplestate.md)オブジェクトとして定義されます。それぞれのトラストラインは、以下のような _双方向_ の関係から成り立っています。
2020

2121
- トラストラインが接続する **2つの[アカウント](../../accounts/index.md)** の識別子
2222
- 一方のアカウントから見てプラス、他方のアカウントから見てマイナスとなる、単一の共有された**残高**

@l10n/ja/docs/references/client-libraries.md

+10-9
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ seo:
1010

1111
その他のプログラミング言語の場合、[HTTP APIs](http-websocket-apis/index.md)を通してXRP Ledgerにアクセスすることが可能です。
1212

13-
| 言語 | ライブラリ名 | Get Started | APIリファレンス | ソースコード |
14-
|---------------------------------|------------------------|--------------|---------------|-------------|
15-
| **Python** | `xrpl-py` | [Pythonを使ってみよう](../tutorials/python/build-apps/get-started.md) | [API リファレンス](https://xrpl-py.readthedocs.io/) | [リポジトリ](https://github.com/XRPLF/xrpl-py) |
16-
| **JavaScript** / **TypeScript** | `xrpl.js` | [JavaScriptを使ってみよう](../tutorials/javascript/build-apps/get-started.md) | [API リファレンス](https://js.xrpl.org/) | [リポジトリ](https://github.com/XRPLF/xrpl.js) |
17-
| **JavaScript** / **TypeScript** | `xrpl-client` | [触ってみる](https://jsfiddle.net/WietseWind/35az6p1b/) | [NPM リファレンス](https://www.npmjs.com/package/xrpl-client) | [リポジトリ](https://github.com/XRPL-Labs/xrpl-client) |
18-
| **JavaScript** / **TypeScript** | `xrpl-accountlib` | [触ってみる](https://jsfiddle.net/WietseWind/gkefpnu0/) | [NPM リファレンス](https://www.npmjs.com/package/xrpl-accountlib) | [リポジトリ](https://github.com/WietseWind/xrpl-accountlib) |
19-
| **C++** | `rippled` 署名ライブラリ | [署名ライブラリを使ってみよう](https://github.com/XRPLF/rippled/tree/develop/Builds/linux#signing-library) | | ([`rippled`](https://github.com/XRPLF/rippled/))の一部 |
20-
| **Java** | `xrpl4j` | [Javaを使ってみよう](../tutorials/java/build-apps/get-started.md) | [API リファレンス](https://javadoc.io/doc/org.xrpl/) | [リポジトリ](https://github.com/XRPLF/xrpl4j) |
21-
| **PHP** | `XRPL_PHP` | [PHPを使ってみよう](../tutorials/php/build-apps/get-started.md) | [XRPL_PHP ドキュメント](https://alexanderbuzz.github.io/xrpl-php-docs/) | [リポジトリ](https://github.com/AlexanderBuzz/xrpl-php) |
13+
| 言語 | ライブラリ名 | Get Started | APIリファレンス | ソースコード |
14+
|---------------------------------|-------------------|----------------------------------------------------------------------------------------------|---------------------------------------------------------------------|--------------------------------------------------------|
15+
| **Python** | `xrpl-py` | [Pythonを使ってみよう](../tutorials/python/build-apps/get-started.md) | [API リファレンス](https://xrpl-py.readthedocs.io/) | [リポジトリ](https://github.com/XRPLF/xrpl-py) |
16+
| **JavaScript** / **TypeScript** | `xrpl.js` | [JavaScriptを使ってみよう](../tutorials/javascript/build-apps/get-started.md) | [API リファレンス](https://js.xrpl.org/) | [リポジトリ](https://github.com/XRPLF/xrpl.js) |
17+
| **JavaScript** / **TypeScript** | `xrpl-client` | [触ってみる](https://jsfiddle.net/WietseWind/35az6p1b/) | [NPM リファレンス](https://www.npmjs.com/package/xrpl-client) | [リポジトリ](https://github.com/XRPL-Labs/xrpl-client) |
18+
| **JavaScript** / **TypeScript** | `xrpl-accountlib` | [触ってみる](https://jsfiddle.net/WietseWind/gkefpnu0/) | [NPM リファレンス](https://www.npmjs.com/package/xrpl-accountlib) | [リポジトリ](https://github.com/WietseWind/xrpl-accountlib) |
19+
| **C++** | `rippled` 署名ライブラリ | [署名ライブラリを使ってみよう](https://github.com/XRPLF/rippled/tree/develop/Builds/linux#signing-library) | | ([`rippled`](https://github.com/XRPLF/rippled/))の一部 |
20+
| **Java** | `xrpl4j` | [Javaを使ってみよう](../tutorials/java/build-apps/get-started.md) | [API リファレンス](https://javadoc.io/doc/org.xrpl/) | [リポジトリ](https://github.com/XRPLF/xrpl4j) |
21+
| **PHP** | `xrpl-php` | [PHPを使ってみよう](../tutorials/php/ecourty_xrpl-php/index.md) | [xrpl-php ドキュメント](https://github.com/EdouardCourty/xrpl-php#readme) | [リポジトリ](https://github.com/EdouardCourty/xrpl-php) |
22+
| **PHP** | `XRPL_PHP` | [PHPを使ってみよう](../tutorials/php/hardcastle_xrpl_php/build-apps/get-started.md) | [XRPL_PHP ドキュメント](https://alexanderbuzz.github.io/xrpl-php-docs/) | [リポジトリ](https://github.com/AlexanderBuzz/xrpl-php) |

docs/references/client-libraries.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ These client libraries simplify some of the common work of accessing and process
1010

1111
For other programming languages, you can access the XRP Ledger through the [HTTP APIs](http-websocket-apis/index.md).
1212

13-
| Language | Library Name | Get Started | API Reference | Source Code |
14-
|---------------------------------|---------------------------|-------------|--------------|-------------|
15-
| **Python** | `xrpl-py` | [Get Started Using Python](../tutorials/python/build-apps/get-started.md) | [API Reference](https://xrpl-py.readthedocs.io/) | [Repo](https://github.com/XRPLF/xrpl-py) |
16-
| **JavaScript** / **TypeScript** | `xrpl.js` | [Get Started](../tutorials/javascript/build-apps/get-started.md) | [API Reference](https://js.xrpl.org/) | [Repo](https://github.com/XRPLF/xrpl.js) |
17-
| **JavaScript** / **TypeScript** | `xrpl-client` | [Get Started](https://jsfiddle.net/WietseWind/35az6p1b/) | [NPM Reference](https://www.npmjs.com/package/xrpl-client) | [Repo](https://github.com/XRPL-Labs/xrpl-client) |
18-
| **JavaScript** / **TypeScript** | `xrpl-accountlib` | [Get Started](https://jsfiddle.net/WietseWind/gkefpnu0/) | [NPM Reference](https://www.npmjs.com/package/xrpl-accountlib) | [Repo](https://github.com/WietseWind/xrpl-accountlib) |
19-
| **C++** | `rippled` Signing Library | [Get Started](https://github.com/XRPLF/rippled/tree/develop/Builds/linux#signing-library) | | (Part of [`rippled`](https://github.com/XRPLF/rippled/)) |
20-
| **Java** | `xrpl4j` | [Get Started Using Java](../tutorials/java/build-apps/get-started.md) | [API Reference](https://javadoc.io/doc/org.xrpl/) | [Repo](https://github.com/XRPLF/xrpl4j) |
21-
| **PHP** | `XRPL_PHP` | [Get Started Using PHP](../tutorials/php/build-apps/get-started.md) | [XRPL_PHP Docs](https://alexanderbuzz.github.io/xrpl-php-docs/) | [Repo](https://github.com/AlexanderBuzz/xrpl-php) |
22-
| **Ruby** | `XRPB` | | [XRPB Docs](https://www.rubydoc.info/gems/xrbp) | [Repo](https://github.com/DevNullProd/XRBP) |
13+
| Language | Library Name | Get Started | API Reference | Source Code |
14+
|---------------------------------|---------------------------|----------------------------------------------------------------------------------------------|-------------------------------------------------------------------|----------------------------------------------------------|
15+
| **Python** | `xrpl-py` | [Get Started Using Python](../tutorials/python/build-apps/get-started.md) | [API Reference](https://xrpl-py.readthedocs.io/) | [Repo](https://github.com/XRPLF/xrpl-py) |
16+
| **JavaScript** / **TypeScript** | `xrpl.js` | [Get Started](../tutorials/javascript/build-apps/get-started.md) | [API Reference](https://js.xrpl.org/) | [Repo](https://github.com/XRPLF/xrpl.js) |
17+
| **JavaScript** / **TypeScript** | `xrpl-client` | [Get Started](https://jsfiddle.net/WietseWind/35az6p1b/) | [NPM Reference](https://www.npmjs.com/package/xrpl-client) | [Repo](https://github.com/XRPL-Labs/xrpl-client) |
18+
| **JavaScript** / **TypeScript** | `xrpl-accountlib` | [Get Started](https://jsfiddle.net/WietseWind/gkefpnu0/) | [NPM Reference](https://www.npmjs.com/package/xrpl-accountlib) | [Repo](https://github.com/WietseWind/xrpl-accountlib) |
19+
| **C++** | `rippled` Signing Library | [Get Started](https://github.com/XRPLF/rippled/tree/develop/Builds/linux#signing-library) | | (Part of [`rippled`](https://github.com/XRPLF/rippled/)) |
20+
| **Java** | `xrpl4j` | [Get Started Using Java](../tutorials/java/build-apps/get-started.md) | [API Reference](https://javadoc.io/doc/org.xrpl/) | [Repo](https://github.com/XRPLF/xrpl4j) |
21+
| **PHP** | `xrpl-php` | [Get Started Using xrpl-php](../tutorials/php/ecourty_xrpl-php/index.md) | [XRPL_PHP Docs](https://github.com/EdouardCourty/xrpl-php#readme) | [Repo](https://github.com/EdouardCourty/xrpl-php) |
22+
| **PHP** | `XRPL_PHP` | [Get Started Using XRPL_PHP](../tutorials/php/hardcastle_xrpl_php/build-apps/get-started.md) | [XRPL_PHP Docs](https://alexanderbuzz.github.io/xrpl-php-docs/) | [Repo](https://github.com/AlexanderBuzz/xrpl-php) |
23+
| **Ruby** | `XRPB` | | [XRPB Docs](https://www.rubydoc.info/gems/xrbp) | [Repo](https://github.com/DevNullProd/XRBP) |

docs/tutorials/how-tos/send-xrp.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ To interact with the XRP Ledger, you need to set up a dev environment with the n
2727
- **JavaScript** with the [xrpl.js library](https://github.com/XRPLF/xrpl.js/). See [Get Started Using JavaScript](../javascript/build-apps/get-started.md) for setup steps.
2828
- **Python** with the [`xrpl-py` library](https://xrpl-py.readthedocs.io/). See [Get Started using Python](../python/build-apps/get-started.md) for setup steps.
2929
- **Java** with the [xrpl4j library](https://github.com/XRPLF/xrpl4j). See [Get Started Using Java](../java/build-apps/get-started.md) for setup steps.
30-
- **PHP** with the [XRPL_PHP library](https://github.com/AlexanderBuzz/xrpl-php). See [Get Started Using PHP](../php/build-apps/get-started.md) for setup steps.
30+
- **PHP** with the [PHP Client Libraries](/docs/tutorials/php/index.md)
3131

3232

3333
## Send a Payment on the Test Net

docs/tutorials/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ These tutorials walk you through the basics of building a very simple XRP Ledger
2020

2121
{% xrpl-card title="Java" body="Using xrpl4j, a pure Java library." href="/docs/tutorials/java/" image="/img/logos/java.svg" imageAlt="Java logo" /%}
2222

23-
{% xrpl-card title="PHP" body="Using the XRPL_PHP client library." href="/docs/tutorials/php/" image="/img/logos/php.svg" imageAlt="PHP logo" /%}
23+
{% xrpl-card title="PHP" body="Using the PHP client libraries." href="/docs/tutorials/php/" image="/img/logos/php.svg" imageAlt="PHP logo" /%}
2424

2525
{% xrpl-card title="HTTP & WebSocket APIs" body="Access the XRP Ledger directly through the APIs of its core server." href="/docs/tutorials/http-websocket-apis/" image="/img/logos/globe.svg" imageAlt="globe icon" /%}
2626

docs/tutorials/php/build-apps/index.md

-14
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Create a wallet
2+
3+
Creating an XRP Wallet is the base operation when building applications that interact with the XRP Ledger.
4+
5+
If you want to import a wallet from an existing seed, refer to the [Import a Wallet](./import-a-wallet.md) tutorial.
6+
7+
Wallets can be generated using two different algorithms:
8+
- ED25519
9+
- SECP256K1
10+
11+
The XRPL-PHP library supports both algorithms. By default, the `ED25519` algorithm is used.
12+
13+
_If you're interested in discovering how the generation workflows work, refer to the [ED25519 Key Derivation](/docs/concepts/accounts/cryptographic-keys.md#ed25519-key-derivation) or [SECP256K1 Key Dreivation](/docs/concepts/accounts/cryptographic-keys.md#secp256k1-key-derivation) documentation page_.
14+
15+
<br />
16+
17+
```php
18+
<?php
19+
20+
use XRPL\Enum\Algorithm;
21+
use XRPL\ValueObject\Wallet;
22+
23+
$ed25519Wallet = Wallet::generate(Algorithm::ED25519);
24+
$secp256k1Wallet = Wallet::generate(Algorithm::SECP256K1);
25+
26+
// Using Wallet::generate(); will use the ED25519 algorithm by default.
27+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
seo:
3+
description: Fund a test wallet on the XRP Ledger using the ecourty/xrpl-php library.
4+
---
5+
6+
# Fund a test wallet
7+
8+
Funding a test wallet is a simple process.
9+
You can use the XRPL PHP library to generate a new wallet and request funds from the XRP Testnet Faucet.
10+
11+
```php
12+
<?php
13+
14+
use XRPL\Enum\Network;
15+
use XRPL\Service\Faucet;
16+
use XRPL\ValueObject\Wallet;
17+
18+
$wallet = Wallet::generate(); // Or Wallet::generateFromSeed('...');
19+
Faucet::addFunds($wallet); // Will add 100 XRP to the Account associated to this wallet
20+
21+
// By default, the Faucet class will fund the wallet on the testnet.
22+
// If you want to fund the wallet on the devnet, you can pass a second argument to the ::addFunds method:
23+
Faucet::addFunds($wallet, Network::DEVNET);
24+
25+
// The Wallet::fundWallet facade method can also be used
26+
$wallet = Wallet::generate();
27+
$wallet->addFunds();
28+
```
29+
30+
{% admonition type="warning" name="Rate limiting" %}
31+
Sending too many requests will trigger the Faucet's rate limit.
32+
Re-import an already funded wallet instead of creating a new random one every time you run your test scripts.
33+
{% /admonition %}
34+
35+
The funded wallets can then be used to submit transactions to the XRP Ledger.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Import a wallet
2+
3+
Importing an existing wallet is a common operation when building applications that interact with the XRP Ledger.
4+
5+
All you need is your wallet seed. It should look like this:
6+
- **ED25519**: `sEdSgVhT1uGZErffGfLHX61ZkjAtPg2` (31 long)
7+
- **SECP256K1**: `ssPjp8iEJug1fFzksyMTQcJKe944V` (29 long)
8+
9+
Then, simply import your wallet using either the `Wallet::generateFromSeed` facade method, or the `WalletGenerator::generateFromSeed` method.
10+
11+
```php
12+
<?php
13+
14+
use XRPL\Service\Wallet\WalletGenerator;
15+
use XRPL\ValueObject\Wallet;
16+
17+
$seed = 'sEdSgVhT1uGZErffGfLHX61ZkjAtPg2';
18+
19+
// 1. Using the Wallet class
20+
$importedWallet = Wallet::generateFromSeed($seed);
21+
22+
// 2. Using the WalletGenerator class
23+
$importedWallet = WalletGenerator::generateFromSeed($seed);
24+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Submit Transactions
2+
3+
Submitting transactions to the XRP Ledger using the `ecourty/xrpl-php` library is a straightforward process.
4+
5+
This tutorial will guide you through the steps to create, sign, and submit a transaction to the XRP Ledger.
6+
All you need is a `Wallet` instance, or your own Wallet class implementing `WalletInterface`.
7+
8+
{% admonition type="info" name="Mandatory Transaction Fields" %}
9+
Every transaction need to contain a `TransactionType` field, which defines the type of transaction you want to submit.
10+
Refer to the [Transaction Types documentation](/docs/references/protocol/transactions/types/index.md) for more information.
11+
{% /admonition %}
12+
13+
```php
14+
<?php
15+
16+
use XRPL\Client\XRPLClient;
17+
use XRPL\ValueObject\Wallet;
18+
19+
$wallet = Wallet::generateFromSeed('...'); // Replace '...' with your seed
20+
21+
$transactionPayload = [
22+
'TransactionType' => 'Payment',
23+
'Account' => $wallet->getAddress(),
24+
'Destination' => 'rPEPPER7kfTD9w2To4CQk6UCfuHM9c6GDY',
25+
'Amount' => '1000000',
26+
];
27+
28+
$client = new XRPLClient('https://s.altnet.rippletest.net:51234');
29+
30+
$result = $client->submitSingleSignTransaction($transactionPayload, $wallet);
31+
```
32+
33+
Every field will then be converted into its own [Internal Format](/docs/references/protocol/binary-format.md#internal-format) before being submitted to the XRP Ledger Node.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
seo:
3+
description: Mint an NFT on the XRP Ledger using the ecourty/xrpl-php library.
4+
---
5+
6+
# Mint an NFT
7+
8+
Minting an NFT on the XRP Ledger is an easy process.
9+
You need to craft your transaction payload with care to avoid any errors:
10+
- Define the flags according to the NFT type you want to mint. [Documentation reference](/docs/references/protocol/transactions/types/nftokenmint#nftokenmint-flags)
11+
- Define the "content" or your NFT in the `URI` field, this is usually an IPFS link to the NFT metadata.
12+
- Craft the transaction!
13+
14+
_Here is the [list of all the available fields on the `NFTokenMint` transaction](/docs/references/protocol/transactions/types/nftokenmint.md)_
15+
16+
<br />
17+
18+
Here is a tutorial on how to mint a simple NFT on the testnet, using a random wallet.
19+
```php
20+
<?php
21+
22+
use XRPL\Client\XRPLClient;
23+
use XRPL\Service\Faucet;
24+
use XRPL\ValueObject\Wallet;
25+
26+
$wallet = Wallet::generate();
27+
Faucet::addFunds($wallet);
28+
29+
echo 'Wallet generated and funded!' . \PHP_EOL;
30+
31+
$client = new XRPLClient('https://s.altnet.rippletest.net:51234');
32+
33+
$transactionData = [
34+
'TransactionType' => 'NFTokenMint',
35+
'Account' => $wallet->getAddress(),
36+
'URI' => '11223344', // Can be virtually anything (Needs to be a hex-encoded)
37+
'Flags' => 8, // Makes the NFT transferable
38+
'TransferFee' => 1000, // Fee for transferring the NFT
39+
'NFTokenTaxon' => 0, // Allows for grouping of NFTs (e.g. by collection, use the same taxon for NFTs of the same collection)
40+
];
41+
42+
$transactionResult = $client->submitSingleSignTransaction($transactionData, $wallet);
43+
44+
echo 'NFT minted!' . \PHP_EOL;
45+
```
46+
47+
Easy, right?
48+
You can then retrieve the transaction hash from the `$transactionResult` object to track the transaction on the XRP Ledger.
49+
50+
More examples can be found in the [ecourty/xrpl-php GitHub repository](https://github.com/EdouardCourty/xrpl-php)

0 commit comments

Comments
 (0)