PHP code example of lsyh / azure-table-service-bundle
1. Go to this page and download the library: Download lsyh/azure-table-service-bundle 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/ */
lsyh / azure-table-service-bundle example snippets
// config/bundles.php
return [
// ...
Lsyh\TableServiceBundle\TableServiceBundle::class => ['all' => true],
];
class AzureTestCommand extends Command
{
public function __construct(
private TableServiceInterface $tableService,
) {
parent::__construct();
}
$azureApiResponse = $this->tableService->createTable('myTable');
$azureApiResponse = $this->tableService->getTable('myTable');
$azureApiResponse = $this->tableService->deleteTable('myTable');
$entity = (new Entity())
->setPartitionKey('partkey1')
->setRowKey('rowkey1')
->addProperty('name', 'John Doe')
->addProperty('age', 30)
->addProperty('isStudent', true)
->addProperty('created', new \DateTime());
$azureApiResponse = $this->tableService->insertEntity('myTable', $entity);
$entity = (new Entity())
->setPartitionKey('partkey1')
->setRowKey('rowkey1')
->addProperty('name', 'John Doe')
->addProperty('age', 30)
->addProperty('isStudent', true)
->addProperty('created', new \DateTime())
->addProperty('binaryTest', 'SomeBinaryData', EdmType::BINARY);
$azureApiResponse = $this->tableService->updateEntity('myTable', $entity);
$azureApiResponse = $this->tableService->delelteEntity('myTable', 'partkey1', 'rowkey1');
$azureApiResponse = $this->tableService->getEntity('myTable', 'partkey1', 'rowkey1');
$azureApiResponse->getEntity();
$azureApiResponse = $this->tableService->getEntity('myTable', 'partkey1', 'rowkey1', 'name', 'age');
$azureApiResponse = $this->tableService->getEntityByFilter('myTable', 'and', 'Timestamp le datetime\'' . $date . '\'');