1.1.0 • Published 4 months ago
nanoweb-sync-php v1.1.0
Nanoweb Sync PHP is a command-line tool for synchronizing files between a local directory and a remote PHP server. It supports different sync strategies, chunked file uploads, and secure authentication.
Features
- Synchronizes local files with a remote PHP server.
- Supports multiple sync strategies:
sync
,merge
,force
. - Handles chunked uploads for large files.
- Supports secure authentication via API tokens.
- Automatically removes outdated remote files.
Installation
npm install -g nanoweb-sync-php
Upload file server/deploy.php
on your server with the PHP support v7.4+.
Upload server/config.example.php
as config.php
in the same directory with deploy.php
and generate string AUTH_KEY
.
Usage
Sync Files
nanoweb-sync-php -host https://example.com -pass YOUR_AUTH_KEY -local ./dist -remote /deploy.php
Options
Option | Description | Default |
---|---|---|
-host | Remote PHP server URL | - |
-pass | Authentication key | - |
-port | Server port | Auto |
-strategy | Sync strategy (sync , merge , force ) | sync |
-local | Local directory to upload | dist |
-remote | Remote PHP script for synchronization | /deploy.php |
-recent | Cache file for faster synchronization | .nanoweb-sync.json |
-public | Public directory to merge before upload | - |
-ignore | Ignore patterns for file exclusion | - |
Environment Variables
Alternatively, you can define settings in a .env
file:
SYNC_HOST=https://example.com
SYNC_PASS=YOUR_AUTH_KEY
SYNC_LOCAL=dist
SYNC_REMOTE=/deploy.php
SYNC_STRATEGY=sync
SYNC_CACHE=.nanoweb-sync.json
SYNC_PUBLIC=public
SYNC_IGNORE=node_modules;tmp;logs
Server Requirements
Ensure the remote server has the deploy.php
script installed and configured:
- Define
AUTH_KEY
inconfig.php
for secure authentication. - Set
NANO_DIR
for managing uploaded files.
License
Contributing
See CONTRIBUTING.md for details on how to contribute.