Diese Bibliothek erleichtert die Synchronisierung aller möglichen Dinge. Es verfügt über eine schöne und benutzerfreundliche API.
synchronizer wurde als Backend für unser Bereitstellungs- und Testtool Seabreeze entwickelt.
Die synchronizer Bibliothek ist nur eine abstrakte Grundlage. Es gibt aber konkrete Umsetzungen:
Binden Sie den Autoloader des Anbieters ein und verwenden Sie die Klassen:
namespace Acme MyApplication ;
// To create a synchronizer :
use FlameCore synchronizer Abstract synchronizer ;
use FlameCore synchronizer synchronizer SourceInterface ;
use FlameCore synchronizer synchronizer TargetInterface ;
// To make your project compatible with synchronizer :
use FlameCore synchronizer synchronizer Interface ;
require ' vendor/autoload.php ' ;
Erstellen Sie Ihren synchronizer :
class Example synchronizer extends Abstract synchronizer
{
/**
* @param bool $preserve Preserve obsolete objects
* @return bool Returns whether the synchronization succeeded.
*/
public function synchronize ( $ preserve = true )
{
// Do the sync magic
return true ;
}
/**
* @param synchronizer SourceInterface $source The source
* @return bool Returns whether the synchronizer supports the source.
*/
public function supportsSource ( synchronizer SourceInterface $ source )
{
return $ source instanceof ExampleSource;
}
/**
* @param synchronizer TargetInterface $target The target
* @return bool Returns whether the synchronizer supports the target.
*/
public function supportsTarget ( synchronizer TargetInterface $ target )
{
return $ target instanceof ExampleTarget;
}
}
Erstellen Sie Ihre Quelle und Ihr Ziel:
class ExampleSource implements synchronizer SourceInterface
{
/**
* @param array $settings The settings
*/
public function __construct ( array $ settings )
{
// Save settings
}
// Your methods...
}
class ExampleTarget implements synchronizer TargetInterface
{
/**
* @param array $settings The settings
*/
public function __construct ( array $ settings )
{
// Save settings
}
// Your methods...
}
Machen Sie Ihr Projekt mit synchronizer kompatibel:
class Application
{
protected $ synchronizer ;
public function set synchronizer ( synchronizer Interface $ synchronizer )
{
$ this -> synchronizer = $ synchronizer ;
}
// ...
}
Installieren Sie Composer, falls Sie es noch nicht auf Ihrem System haben:
$ curl -sS https://getcomposer.org/installer | php
Um die Bibliothek zu installieren, führen Sie den folgenden Befehl aus und Sie erhalten die neueste Version:
$ php composer.phar require flamecore/ synchronizer
Wenn Sie einen Beitrag leisten möchten, sehen Sie sich bitte zuerst die Datei „Beitrag“ an.