定制 marceli-to/statamic-sync 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

marceli-to/statamic-sync

最新稳定版本:v0.5.0

Composer 安装命令:

composer require marceli-to/statamic-sync

包简介

Sync Statamic content and assets from remote environments to local.

README 文档

README

Pull Statamic content and assets from a remote environment to your local setup — no FTP, no SSH, just one artisan command.

How It Works

  1. The package exposes a protected endpoint on your remote site
  2. When you run statamic:pull, it compares local and remote files via hash manifests
  3. Only new, changed, and deleted files are synced — unchanged files are skipped
  4. Files are streamed as compressed tar.gz archives directly from the server

First run downloads everything. Subsequent runs only sync the diff.

Requirements

  • PHP 8.1+
  • Laravel 10, 11, or 12
  • tar available on both server and local machine (standard on Linux/macOS)

Installation

Install the package on both your local and remote environments:

composer require marceli-to/statamic-sync

Configuration

Publish the config (optional — defaults work out of the box):

php artisan vendor:publish --tag=statamic-sync-config

Environment Variables

Both environments (local + remote):

STATAMIC_SYNC_TOKEN=your-shared-secret-here

Generate a secure token:

openssl rand -hex 32

Local environment only:

STATAMIC_SYNC_REMOTE=https://your-production-site.com

Usage

Pull everything (content + assets)

php artisan statamic:pull

Pull only content

php artisan statamic:pull --only=content

Pull only assets

php artisan statamic:pull --only=assets

Dry run (see what would change)

php artisan statamic:pull --dry-run

Output shows exactly what would happen:

content:
  Unchanged: 52 files
  Changed:   3 files
  New:       2 files
  Deleted:   1 files
  Download:  12.5 KB

assets:
  Unchanged: 820 files
  New:       3 files
  Download:  4.2 MB

Force full sync (skip delta comparison)

php artisan statamic:pull --full

Skip confirmation

php artisan statamic:pull --force

Configuration Options

// config/statamic-sync.php

return [
    // Shared secret for authentication (required on both sides)
    'token' => env('STATAMIC_SYNC_TOKEN', ''),

    // Remote URL to pull from (local side only)
    'remote' => env('STATAMIC_SYNC_REMOTE', ''),

    // Directories to sync (relative to project root)
    'paths' => [
        'content' => 'content',
        'assets' => 'public/assets',
    ],

    // URL prefix for the sync endpoint
    'route_prefix' => '_sync',

    // Optional IP whitelist (empty = allow all, token still required)
    'allowed_ips' => [],
];

Updating

Update only this package:

composer update marceli-to/statamic-sync

Remember to update on both local and remote when upgrading.

Security

  • All requests require a valid bearer token
  • Optional IP whitelisting for additional protection
  • Use a strong, unique token — openssl rand -hex 32
  • The sync endpoints are only accessible with a valid token
  • Directory traversal protection on file serving

License

MIT

统计信息

  • 总下载量: 29
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固