PHP code example of phpolar / storage

1. Go to this page and download the library: Download phpolar/storage 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/ */

    

phpolar / storage example snippets


class KafkaStorage extends AbstractStorage
{
    public function __construct(
        // ...
    ) {
        parent::__construct($lifeCycleHooks);
        // ...
    }
    // ...
}


$key0 = uniqid();

$kafkaStorage->save($key0, $data);

$result = $kafkaStorage->find($key0);

$item0 = $result
    ->orElse(static function () {
            $this->logger->warn($notFoundMessage);
            return new ResourceNotFound();
        }
    )
    ->tryUnwrap()

$numItems = $kafkaStorage->count();

$allItems = $kafkaStorage->findAll();

$kafka->remove($key0);

$kafka->clear();