1. Go to this page and download the library: Download idynsys/synced-module 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/ */
idynsys / synced-module example snippets
public function getRouteKey(): string; //название маршрута (используется как основной топик)
public function getSyncedAttributes(): array; // подготовленные данные к отправке в топик
public function getTopics(): array; //дополнительные топики
class User implements SyncedModelInterface
{
use Synced;
public function __construct(array $attributes = [])
{
parent::__construct($attributes);
$this->registerSyncedListeners();
}
/**
* route key of model
*/
public function getRouteKey(): string
{
return 'user';
}
/**
* prepare attributes to recieve
*/
public function getSyncedAttributes(): array
{
return $this->toArray();
}
/**
* additional topics
*/
public function getTopics(): array
{
return [];
}
}
public function createByKafka(KafkaPublishData $data);
public function updateByKafka(KafkaPublishData $data);
public function deleteByKafka(KafkaPublishData $data);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.