PHP code example of ajaxray / laravel-server-sync

1. Go to this page and download the library: Download ajaxray/laravel-server-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/ */

    

ajaxray / laravel-server-sync example snippets


'production' => [
    'host' => 'prod.example.com',
    'user' => 'deploy',
    'path' => '/var/www/app',
    'key' => '/home/user/.ssh/production_key',
],
bash
php artisan vendor:publish --provider="Ajaxray\ServerSync\ServerSyncServiceProvider"
bash
php artisan sync:pull
bash
# Skip database sync entirely
php artisan sync:pull --skip-db

# Exclude specific tables
php artisan sync:pull --exclude-tables=logs,cache,sessions

# Only sync specific tables
php artisan sync:pull --only-tables=users,products,orders
bash
# Skip file sync entirely
php artisan sync:pull --skip-files

# Sync files with deletion (removes local files that don't exist in production)
php artisan sync:pull --delete
bash
php artisan sync:pull --remote=staging

# Override server details inline
php artisan sync:pull --host=prod.example.com --user=deploy --path=/var/www/app

# Specify SSH key file for authentication
php artisan sync:pull --key=/path/to/private/key

# All options can be specified inline to overwrite config values
php artisan sync:pull --host=prod.example.com --user=deploy --key=~/.ssh/production_key --exclude-tables=logs,migrations