{"id":23468895,"url":"https://github.com/jamielsharief/file-sync","last_synced_at":"2025-04-12T21:57:37.160Z","repository":{"id":56996286,"uuid":"311447626","full_name":"jamielsharief/file-sync","owner":"jamielsharief","description":"A HTTP based file synchronization library that uses public key authentication.","archived":false,"fork":false,"pushed_at":"2020-11-22T09:18:52.000Z","size":77,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T21:57:31.578Z","etag":null,"topics":["file","http","public-key-authentication","sync"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jamielsharief.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-09T19:45:40.000Z","updated_at":"2020-11-22T09:27:45.000Z","dependencies_parsed_at":"2022-08-21T14:10:29.677Z","dependency_job_id":null,"html_url":"https://github.com/jamielsharief/file-sync","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamielsharief%2Ffile-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamielsharief%2Ffile-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamielsharief%2Ffile-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jamielsharief%2Ffile-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jamielsharief","download_url":"https://codeload.github.com/jamielsharief/file-sync/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637791,"owners_count":21137538,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file","http","public-key-authentication","sync"],"created_at":"2024-12-24T14:36:47.342Z","updated_at":"2025-04-12T21:57:37.129Z","avatar_url":"https://github.com/jamielsharief.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Sync (beta)\n\n![license](https://img.shields.io/badge/license-MIT-brightGreen.svg)\n[![Build Status](https://travis-ci.com/jamielsharief/file-sync.svg?branch=main)](https://travis-ci.com/jamielsharief/file-sync)\n[![Coverage Status](https://coveralls.io/repos/github/jamielsharief/file-sync/badge.svg?branch=main)](https://coveralls.io/github/jamielsharief/file-sync?branch=main)\n\nA HTTP based file synchronization library that uses public key authentication.\n\nThis library can be used to install or update applications from private sources, sync data files or for any other reason that you can think of where you might want `rsync` functionality but to be able to control it using PHP easily.\n\n## Setup\n\nCreate the script on the remote server e.g. `sync.php` on the server, that `Client` will communicate with.\n\n```php\nuse FileSync\\Server;\n$server = new Server(__DIR__ . '/storage/keys');\n$server-\u003edispatch('/server/data');\n```\n\nCall the `Client` `dispatch` method from a script or your application\n\n```php\nuse FileSync\\Client;\n$client = new Client(__DIR__ . '/storage/keys');\n$client-\u003edispatch('https://localhost:8000/sync.php','demo@example.com','/var/www/app.example.com/public_html');\n```\n\n## Generating Key Pairs\n\n`FileSync` looks for keys using the extension based upon type of key that it needs  e.g. `.privateKey` and `.publicKey`.\n\nYou need to generate a `private` key and save this on the client machine, save the `public` key on the server in the keychain folder when you are creating instances.\n\n### PHP\n\n`FileSync` uses the [jamielsharief/encryption](https://github.com/jamielsharief/encryption) library for encryption and decryption.\n\n\nTo generate a key pair\n\n```php\nuse Encryption\\Keypair;\n$keyPair = KeyPair::generate();\necho $keyPair-\u003eprivateKey();\necho $keyPair-\u003epublicKey();\n```\n\nTo generate a private key only\n\n```php\nuse Encryption\\PrivateKey;\n$privateKey = PrivateKey::generate();\n```\n\nTo work with private or public keys\n\n```php\n$publicKey = PublicKey::load($pathToKey);\n$privateKey = PrivateKey::load($pathToKey);\n```\n\nSee [jamielsharief/encryption](https://github.com/jamielsharief/encryption) for more information.\n\n### Command Line\n\nTo generate a `private` key and save this to a file\n\n```bash\n$ openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out demo@example.com.privateKey\n```\n\nTo generate a `public` key from the `private` key\n\n```bash\n$ openssl rsa -in demo@example.com.privateKey -pubout \u003e demo@example.com.publicKey\n```\n\n\n## Ignoring Files\n\n\u003e You should NEVER sync a folder that contains private data with other people. \n\nTo ignore files on either the client or server just create a `.syncignore` file.\n\nHere is an example show how to exclude single files, files with an extension or complete folders\n\n```bash\nversion.txt\nconfig/details.conf\n*.json\nvendor/\n```\n\n## Demo\n\nTo load the demo, first start the built in PHP web server\n\n```bash\n$ php -S localhost:8000\n```\n\nThen run the following command, this will create a folder called `dest` and sync the files from `src`.\n\n```bash\n$ php demo.php\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamielsharief%2Ffile-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjamielsharief%2Ffile-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjamielsharief%2Ffile-sync/lists"}