1. Go to this page and download the library: Download jlucki/spark 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/ */
jlucki / spark example snippets
public function __construct(
private Spark $spark,
) {}
$spark = new Spark(
'latest', // version
'us-east-1', // region
'http://dynamodb:8000', // endpoint, use 'regional' for production
'aws_access_key_id', // your aws access key
'aws_access_key_secret', // your aws access key secret
);
$date = new DateTime();
$blog = (new Article())
->setType('blog')
->setDatetime($date)
->setSlug('my-blog-post-' . $date->format('y-m-d-H-i-s'))
->setTitle('My Blog Post ' . $date->format('Y-m-d H:i:s'))
->setContent('<p>Hello, this is the blog post content.</p>');
// putItem() will return the same object that it persisted to DynamoDB
$blog = $spark->putItem($blog);
// getCount() will automatically loop through any additional results
// if the first query result contains a LastEvaluatedKey to get the full count
$totalBlogs = $spark
->query(Article::class)
->findBy(
(new Expression())
->attribute('datetime')
->comparison('>=')
->value($from)
)
->findBy(
(new Expression())
->attribute('type')
->value('blog')
)
->getCount();
$dynamoDbClient = $spark->client();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.