1. Go to this page and download the library: Download pluginscart/dynamodb-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$result = $ddb->createTable('User', 'UserId');
// Create a table 'User', which has a hash key 'UserId' as STRING.
$result = $ddb->createTable('User', 'UserId::N');
// Create a table 'User', which has a hash key 'UserId' as NUMBER.
$result = $ddb->createTable('Friend', 'UserId', 'FriendUserId');
// Create a table 'Friend', which has a hash key 'UserId' as STRING and a range key 'FriendUserId' as STRING.
$options = array(
'LocalSecondaryIndexes' => array(
array('name' => "UserName",
'type' => 'S',
'projection_type' => 'KEYS_ONLY'
),
array('name' => "CreatedAt",
'type' => 'S',
'projection_type' => 'KEYS_ONLY'
)
)
);
$result = $ddb->createTable('Friend', 'UserId', 'FriendUserId', $options);
// Create a table 'Friend', which has a hash key 'UserId' as STRING and a range key 'FriendUserId' as STRING and Local Secondary Index 'UserName' and 'CreatedAt' as both STRING.
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.