承接 zerofyi/shipit 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

zerofyi/shipit

最新稳定版本:v1.1.1

Composer 安装命令:

composer require zerofyi/shipit

包简介

A zero-dependency dual-protocol deployment wizard for Hostinger shared hosting.

README 文档

README

Latest Version on Packagist Total Downloads Software License PHP Version Support

ShipIt is an enterprise-grade, zero-dependency deployment engine engineered specifically to bridge local development environments with Hostinger Shared Hosting architectures.

It cleanly handles the entire deployment pipeline in under a minute — staging your git changes, pushing code upstream, establishing secure trust handshakes, streaming compiled UI bundles, and firing remote Laravel optimizations over strict circuit-breaking SSH channels.

🔥 Key Features

  • Dual-Protocol Smart Switching: Keeps your local machine on HTTPS while forcing the Hostinger server to communicate over SSH via private deployment identities — no conflicts, no credential clashes.
  • Agnostic Privacy Detection: Pre-flights repository visibility automatically. Public repos clone and pull over HTTPS without any key setup. Private repos activate the token injection core.
  • Automated Deploy Key Injection: Uses your GITHUB_API_TOKEN to handle remote RSA key creation and GitHub handshaking end-to-end. Falls back to a guided manual card if token access is unavailable.
  • Compressed Asset Streaming: Skips slow FTP uploads entirely. Locally built Vite/Mix bundles are archived and streamed as compressed binaries directly over your active SSH session.
  • Circuit-Breaker Pipeline: If any remote step fails, the engine halts immediately to protect your live site from partial deployments.

💾 Installation

composer require zerofyi/shipit

The package uses Laravel's auto-discovery — no manual provider registration needed.

✅ Prerequisites

Before using ShipIt, make sure both of the following are in place on your Hostinger account:

🔑 Passwordless SSH Connection

ShipIt communicates with your server entirely over SSH. Your local machine must be able to connect without being asked for a password or passphrase.

If that's not set up yet, see the SSH Setup Guide ↓

⚙️ PHP exec Must Be Enabled

ShipIt runs remote shell commands via PHP's exec() function. Hostinger disables it by default — you must remove it from the disabled functions list before ShipIt can operate.

hPanel → your website → Advanced → PHP Configuration → PHP Options → Disable Functions

Find exec in the list and remove it, then save.

📖 Official guide: How to Enable Disabled PHP Functions in Hostinger → hostinger.com

⚠️ Without this, ShipIt will silently fail during the server sync phase regardless of SSH or any other configuration being correct.

⚙️ Environment Configuration

Add the following to your local .env file:

# ------------------------------------------------------------------------------
# GitHub
# ------------------------------------------------------------------------------
GITHUB_REPO_URL=https://github.com/your-username/your-repo.git
# GITHUB_API_TOKEN=

# ------------------------------------------------------------------------------
# Hostinger
# ------------------------------------------------------------------------------
HOSTINGER_SSH_HOST=12.34.56.78
HOSTINGER_SSH_USERNAME=u123456789
HOSTINGER_SSH_PORT=65002
HOSTINGER_SITE_DIR=yourdomain.com

💡 GITHUB_API_TOKEN is optional. If your repository is private and you want ShipIt to handle GitHub deploy key registration fully automatically — with no manual steps — add a Fine-grained Personal Access Token here. See how to generate one ↓

📡 Not sure where to find your Hostinger SSH details? See Step 1 of the SSH Setup Guide ↓

🔒 HOSTINGER_SITE_DIR is validated against path traversal payloads (.., /, \) before any remote operation runs.

🚀 Usage

Deploy to Hostinger

php artisan push:hostinger

The master deployment command. Builds assets locally, commits and pushes to GitHub, then syncs your server and runs all remote optimizations in one shot.

Flag Description
--dry-run Simulates the entire pipeline — checks environments, builds assets, and tests the server connection — without touching your live server. Perfect for testing before a real deploy.
--debug Prints raw network payloads, shell command statuses, and step-by-step error traces directly in your terminal.

Push to GitHub Only

php artisan push:github

Standalone Git command. Scans for uncommitted changes, prompts for a commit message, and pushes to your remote branch.

Flag Description
--dry-run Checks your uncommitted changes and active branch, but halts before staging or committing anything.
--debug Streams raw Git execution output directly to your terminal.
--skip-assets Bypasses local asset compilation (npm run build). Used internally by push:hostinger to ensure assets are only built once per full run.
--timeout=60 Maximum execution time in seconds for the Git push operation. Defaults to 60 if not specified.

📐 Deployment Pipeline

push:hostinger runs these phases in strict sequence:

  1. Environment Scan — Validates and sanitizes all .env values before any network activity begins.
  2. Asset Compilation — Detects package.json, installs dependencies if needed, and runs a production build.
  3. Git Commit & Push — Stages your changes, collects a commit message, and pushes to your remote branch.
  4. Server Connection — Opens a passwordless SSH tunnel to Hostinger and confirms the target site directory exists.
  5. GitHub Trust Check — Evaluates repository visibility. Generates and registers an RSA deploy key for private repos, or skips for public ones.
  6. Sync & Optimize — Pulls the latest code, streams compressed asset bundles, then runs the full remote chain:
    • Preserves your production .env
    • composer install --no-dev --optimize-autoloader
    • php artisan migrate --force
    • php artisan storage:link
    • ln -sfn public public_html
    • php artisan optimize

🛠 SSH Setup Guide

One-time setup. Once done, ShipIt connects to your server automatically on every deploy.

Official Hostinger reference: How to Generate SSH Keys and Add Them to hPanel → hostinger.com

Step 1 — Enable SSH in hPanel

Log into hPanel → SSH Access and make sure SSH is enabled for your plan. Your SSH host, username, and port are all listed on this page — copy them into your .env.

Hostinger hPanel SSH Access details

Step 2 — Generate an SSH Key Pair

Run one of these commands on your local machine:

Ed25519 (recommended — modern, faster):

ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519 -C "shipit"

RSA 4096 (broader compatibility):

ssh-keygen -t rsa -b 4096 -N "" -f ~/.ssh/id_rsa -C "shipit"

The -N "" flag sets an empty passphrase automatically — no prompts, no hanging.

Step 3 — Print & Copy Your Public Key

Ed25519:

cat ~/.ssh/id_ed25519.pub

RSA:

cat ~/.ssh/id_rsa.pub

Select and copy the entire output — it starts with ssh-ed25519 or ssh-rsa and ends with shipit.

Step 4 — Add the Key to Hostinger hPanel

  1. In hPanel → SSH Access, click Add SSH Key.
  2. Paste the copied key into the public key field.
  3. Give it a name (e.g. shipit) and save.

Step 5 — Test the Connection

ssh -p YOUR_SSH_PORT YOUR_SSH_USERNAME@YOUR_SSH_HOST

If you land in the remote shell with no password prompt, you're all set. ShipIt is ready to deploy.

If it still asks for a password, confirm the correct key was saved in hPanel and that SSH is enabled on your plan.

🔐 Generating a GitHub Fine-Grained Token

A Fine-grained Personal Access Token is required only if your repository is private and you want ShipIt to register the server's deploy key on GitHub automatically without any manual steps.

1. Go to GitHub token settings: https://github.com/settings/personal-access-tokens/new

2. Fill in the basics:

  • Token name — e.g. shipit-deploy
  • Expiration — set to your comfort level (90 days recommended)
  • Resource owner — select your account or org

3. Under Repository access:

  • Choose Only select repositories
  • Select the specific repo ShipIt will deploy

4. Under Permissions → Repository permissions:

  • Find Administration and set it to Read and Write

This is the only permission ShipIt needs — it uses it solely to register the server's deploy key on your repo so the server can pull code.

5. Click Generate token, copy it immediately, and add it to your .env:

GITHUB_API_TOKEN=github_pat_yourTokenHere

📄 License

The MIT License (MIT). Please see the License File for more details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固