{"id":23718442,"url":"https://github.com/beliven-it/laravel-sync","last_synced_at":"2026-02-10T23:30:16.365Z","repository":{"id":270008173,"uuid":"909119321","full_name":"beliven-it/laravel-sync","owner":"beliven-it","description":"A bash script for pull/push content between environments","archived":false,"fork":false,"pushed_at":"2025-01-27T23:30:17.000Z","size":53,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-28T00:29:25.480Z","etag":null,"topics":["bash","environments","laravel","statamic","sync"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/beliven-it.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Beliven"}},"created_at":"2024-12-27T19:27:18.000Z","updated_at":"2025-01-27T23:30:15.000Z","dependencies_parsed_at":"2024-12-27T20:23:11.487Z","dependency_job_id":"6f7b32b9-409a-444f-83f1-c7998a559c7b","html_url":"https://github.com/beliven-it/laravel-sync","commit_stats":null,"previous_names":["beliven-it/laravel-sync"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliven-it%2Flaravel-sync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliven-it%2Flaravel-sync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliven-it%2Flaravel-sync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beliven-it%2Flaravel-sync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beliven-it","download_url":"https://codeload.github.com/beliven-it/laravel-sync/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239808461,"owners_count":19700442,"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":["bash","environments","laravel","statamic","sync"],"created_at":"2024-12-30T21:22:14.790Z","updated_at":"2026-02-10T23:30:16.304Z","avatar_url":"https://github.com/beliven-it.png","language":"Shell","funding_links":["https://github.com/sponsors/Beliven"],"categories":[],"sub_categories":[],"readme":"# Laravel Sync\n\n\u003cbr /\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"GitHub Release\" src=\"https://img.shields.io/github/v/release/beliven-it/laravel-sync?style=for-the-badge\u0026labelColor=2a2c2e\u0026color=0fbccd\" /\u003e\n\u003c/p\u003e\n\n\u003cbr /\u003e\n\nA bash script used to sync the Laravel project contents between different environments.\n\n## 💫 Usecase\n\nThe main scope of the script is used to sync the database and assets between different environments.\n\nFor example, you can have a [Statamic](https://statamic.com/) project in production costantly updated with new content by the client.\nYou need to sync the contents of your local environment to test the new features with a real snapshot of the production environment.\n\nWith this script you can now sync the database and assets between the environments 🌟🌟🌟!!!\n\n\u003e [!WARNING]\n\u003e ⚠️ ⚠️ ⚠️\n\u003e\n\u003e This script provide a `push` command to a remote environment.\n\u003e Make sure to have a backup of the remote environment before using the `push` command.\n\u003e\n\u003e ⚠️ ⚠️ ⚠️\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## 🔗 Requirements\n\nThe script requires the following tools:\n\n- 🐳 [Docker](https://www.docker.com/) - Used if you use sail layer.\n- 🌐 [SSH](https://www.openssh.com/) - Used to connect to the remote server.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## ⚙️ Installation\n\nYou can install the script in your laravel project using the following command:\n\n```bash\ncurl https://raw.githubusercontent.com/beliven-it/laravel-sync/main/install.sh | bash\n```\n\nThis command download the latest release of the script and make it executable.\n\n### Global installation\n\nYou can also move the file to a directory that is in your `$PATH`, such as `/usr/local/bin`.\n\n```bash\nsudo mv laravel-sync /usr/local/bin\n```\n\nThis allow you to run the script from any directory.\n\n```bash\nlaravel-sync -h\n```\n\n\u003e [!NOTE]\n\u003e\n\u003e Make sure to use a tagged version of the script to avoid any issue.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## 🛠 Configuration\n\nThe script uses the `.env` file as configuration.\n\nMake sure to add the following variable to the `.env` file:\n\n```bash\necho \"SYNC_ENVIRONMENT_ALLOWED='staging production'\" \u003e\u003e .env\n```\n\nIf you have a different environment, you can add it to the `SYNC_ENVIRONMENT_ALLOWED` variable.\n\n```bash\n# For example if you have staging, uat and production environments\necho \"SYNC_ENVIRONMENT_ALLOWED='staging uat production'\" \u003e\u003e .env\n```\n\nAt the first run:\n\n```bash\n\n./laravel-sync config\n\n```\n\nThis command create inside the `.env` the env needed to use the script. An example of the `.env` file is:\n\n```bash\nSYNC_ENVIRONMENT_ALLOWED=\"staging production\"\n\n# Folders to download / upload\nSYNC_ENVIRONMENT_ASSETS=\"storage/statamic/glide/containers content\"\n\n# Local environment\n# Database environment\nSYNC_ENVIRONMENT_LOCAL_DB_HOST=\"${DB_HOST}\"\nSYNC_ENVIRONMENT_LOCAL_DB_PORT=\"${DB_PORT}\"\nSYNC_ENVIRONMENT_LOCAL_DB_USERNAME=\"${DB_USERNAME}\"\nSYNC_ENVIRONMENT_LOCAL_DB_PASSWORD=\"${DB_PASSWORD}\"\nSYNC_ENVIRONMENT_LOCAL_DB_DATABASE=\"${DB_DATABASE}\"\nSYNC_ENVIRONMENT_LOCAL_DB_CONNECTION=\"${DB_CONNECTION}\"\n\n# Host environment for local is not needed\n\n# Staging environment\n# # Database environment\nSYNC_ENVIRONMENT_STAGING_DB_HOSTNAME=\nSYNC_ENVIRONMENT_STAGING_DB_PORT=\nSYNC_ENVIRONMENT_STAGING_DB_PASSWORD=\nSYNC_ENVIRONMENT_STAGING_DB_USERNAME=\nSYNC_ENVIRONMENT_STAGING_DB_DATABASE=\nSYNC_ENVIRONMENT_STAGING_DB_CONNECTION=\n\n# Host environment\nSYNC_ENVIRONMENT_STAGING_HOST_USER=\nSYNC_ENVIRONMENT_STAGING_HOST_HOSTNAME=\nSYNC_ENVIRONMENT_STAGING_HOST_PORT=\nSYNC_ENVIRONMENT_STAGING_HOST_BASE_PATH=\n\n# Production environment\n# Database environment\nSYNC_ENVIRONMENT_PRODUCTION_DB_HOST=\nSYNC_ENVIRONMENT_PRODUCTION_DB_PORT=\nSYNC_ENVIRONMENT_PRODUCTION_DB_USERNAME=\nSYNC_ENVIRONMENT_PRODUCTION_DB_PASSWORD=\nSYNC_ENVIRONMENT_PRODUCTION_DB_DATABASE=\nSYNC_ENVIRONMENT_PRODUCTION_DB_CONNECTION=\n\n# Host environment\nSYNC_ENVIRONMENT_PRODUCTION_HOST_HOSTNAME=\nSYNC_ENVIRONMENT_PRODUCTION_HOST_PORT=\nSYNC_ENVIRONMENT_PRODUCTION_HOST_USER=\nSYNC_ENVIRONMENT_PRODUCTION_HOST_BASE_PATH=\n```\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## 💻 Usage\n\nThe script require one of following actions:\n\n- **pull** - Pull the database and assets from the remote environment.\n- **push** - Push the database and assets to the remote environment.\n- **config** - Setup the `.env` file.\n\nWhen you use the `pull` or `push` actions, you need to specify the environment. For example:\n\n```bash\n\n./laravel-sync pull staging\n```\n\nor\n\n```bash\n\n./laravel-sync push staging\n```\n\nThe following options are also available\n\n```bash\n-a, --ignore-database  Ignore database sync\n-d, --ignore-assets    Ignore assets sync\n-k, --use-docker       Use docker for database sync\n-s, --sendbox          Show only the commands without executing\n-y, --yes              Skip confirmation\n-c, --no-cleanup       Skip cleanup\n-h, --help             Show this help\n```\n\nRun the help command to see the list of available examples:\n\n```bash\n\n./laravel-sync -h\n```\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## 💬 FAQs\n\n### How to pull the remote environment to a local environment that use Sail?\n\nYou can use the `--use-docker` option to use Docker to pull the database. For example:\n\n```bash\n./laravel-sync pull staging --use-docker\n\n# ... or using the short flag version\n\n./laravel-sync pull staging -k\n```\n\n### How can avoid to run SSH command with plain text password?\n\nYou can edit the `.env` file and add set the: `SYNC_ENVIRONMENT_\u003cenvironment_choosed\u003e_DB_PASSWORD` to empty.\n\nWhen you launch the commands, the script will ask you to insert the password.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## 👨‍💻 Development\n\nClone the repository and start to develop the script.\n\nMake sure to run use `shellcheck` to lint the script.\n\n```bash\nshellcheck laravel-sync\n```\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## 📝 Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n\u003cbr /\u003e\u003cbr /\u003e\n\n## 📝 License\n\nThe script is open-sourced software licensed under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliven-it%2Flaravel-sync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeliven-it%2Flaravel-sync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeliven-it%2Flaravel-sync/lists"}