Download the PHP package viovenia/statamic-git-sync without Composer

On this page you can find all versions of the php package viovenia/statamic-git-sync. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package statamic-git-sync

Statamic Git Sync

Automatic git commit — and optionally git push — when content changes in the Statamic control panel.

A free, event-driven alternative to Statamic Pro's built-in Git Automation. Runs on Statamic Solo.

Tests

Why this exists

Statamic keeps content in flat files, which makes git the natural place for it: review, revert, deploy-by-push, CI. Statamic can commit those changes for you — but only on Pro.

The free options had all run out:

Project State Why it does not solve this
Statamic Git Automation (core) active Pro only
statamic/spock archived since 2020, Statamic 2.10 dead; the feature was absorbed into Pro
Gitamic active, paid a manual git UI in the control panel, no automation
diffrentdigital/git-auto-push available a blunt 24 hour cron commit, not event driven

This addon fills the gap: MIT, event driven, and built to be left alone on a production server.

What it does

And when something goes wrong it does the boring, safe thing: a conflicting rebase is aborted and the working tree is left exactly as it was.

Requirements

php artisan statamic:git-sync:doctor checks all of this and tells you what to fix.

Installation

Publish the config when you want to change anything:

Then confirm the setup:

Quickstart

Commit locally on every content change — the default, nothing to configure:

Commit and push to origin:

Push over SSH with a deploy key the web user can read:

See what would happen without touching anything:

How it works

Nothing happens in the save request. The subscriber writes a timestamp and queues a job. A broken git setup can never stop somebody from saving their work.

Debouncing collects an editing session. Every change pushes the run out by debounce.seconds (60 by default). A job that wakes up to find a newer change waiting steps aside, so ten saves in a minute become one commit.

Two runs never overlap. The queue job carries Laravel's WithoutOverlapping middleware, and the console and scheduled paths take the same cache lock.

The cache is timing, not truth. Whatever is committed is read from git status at the moment of the run. If the cache is flushed the addon loses the bundling, never the changes — and a scheduled safety net (*/15 * * * *) commits anything left behind. The worst case of a cache outage is a delay of a few minutes.

Only your content is staged. Git is asked about the allow list only, and the result is filtered again, so an unrelated change in app/ can never ride along with a content commit.

Loop guard. Every commit carries Committed-by: statamic-git-sync. A deploy that pulls does not fire Statamic events, so pulls cannot trigger commits.

Failures are classified. A lost network on push retries with backoff. A missing git binary does not, because it will still be missing in thirty seconds. A conflict is rolled back and reported, because it needs a person.

Configuration

Every option lives in config/statamic-git-sync.php and has an env() override. The full reference — default, effect and the pitfall of each — is in docs/configuration.md. The short version:

Group What it controls
enabled, dry_run, strategy master switch, rehearsal mode, how changes reach the remote
repository path, git binary, timeout, environment (SSH command)
content the path allow list and the exclude globs
commit message template, trailer, author, signing
pull / push integrating remote work and publishing
debounce / queue how long to collect, and where the job runs
safety_net the scheduled fallback that makes cache loss harmless
events each Statamic event individually
logging channel and level

Commands

Command Purpose
statamic:git-sync Commit what is pending now. --dry-run reports without writing.
statamic:git-sync:status What is pending, and the configuration in effect.
statamic:git-sync:doctor Check the whole setup. Exits non-zero when something is broken, so it works as a deploy gate.

Events

Listen to these to send notifications, collect metrics, or trigger a deploy:

SyncStarted · SyncCompleted · SyncSkipped · SyncFailed · ConflictDetected · PullRequestOpened

Each carries typed DTOs rather than loose scalars. See docs/advanced.md.

How it compares

Pro Git Automation Gitamic Statamic Git Sync
Needs Statamic Pro yes no no
Price part of Pro paid free, MIT
Automatic on content change yes no yes
Manual git UI in the CP no yes no
Debounced commits no yes
Pull request instead of push no no yes
Self-check command no no yes
Scheduled safety net no yes

Pull request mode

Instead of pushing straight to the branch everybody deploys from, the addon can push the branch the instance is on and open a pull request against another one — so content changes get reviewed like code. The built-in Pro automation cannot do this.

It never checks out another branch — that would swap the content files on disk underneath the editor who just saved them. So the authoring instance lives on its own branch (content/staging), and base is where it should be merged. doctor refuses the setup when the two are the same.

Within a debounce window the first run opens the pull request and later runs push commits onto it, rather than opening one per save. Details in docs/configuration.md.

Notifications

Mail out of the box, Slack with one extra package:

Failures, conflicts and opened pull requests by default; successful commits are available but off, because on a busy site that is a channel nobody reads. Details in docs/configuration.md.

Control panel widget

A dashboard widget showing the last few syncs — what was committed, what failed, which pull request it went into. Add it in config/statamic/cp.php:

It reads a JSONL file under storage/, which survives the cache:clear in your deploy. Losing it costs the widget its contents and nothing else — git remains the record of what was committed.

GitLab works too — merge requests instead of pull requests, nested groups included:

Roadmap

Nothing planned. Gitea and Forgejo would each be one class behind PullRequestClientContract — see docs/advanced.md if you want one.

Contributing

Bug reports and pull requests are welcome — see CONTRIBUTING.md.

Credits

Built by Viovenia. Not affiliated with, or endorsed by, Statamic.

License

MIT — see LICENSE.


All versions of statamic-git-sync with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
statamic/cms Version ^5.0 || ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package viovenia/statamic-git-sync contains the following files

Loading the files please wait ...