PHP code example of jamielsharief / file-sync

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

    

jamielsharief / file-sync example snippets


use FileSync\Server;
$server = new Server(__DIR__ . '/storage/keys');
$server->dispatch('/server/data');

use FileSync\Client;
$client = new Client(__DIR__ . '/storage/keys');
$client->dispatch('https://localhost:8000/sync.php','[email protected]','/var/www/app.example.com/public_html');

use Encryption\Keypair;
$keyPair = KeyPair::generate();
echo $keyPair->privateKey();
echo $keyPair->publicKey();

use Encryption\PrivateKey;
$privateKey = PrivateKey::generate();

$publicKey = PublicKey::load($pathToKey);
$privateKey = PrivateKey::load($pathToKey);
bash
$ php demo.php