承接 nettt/nettt-tools 相关项目开发

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

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

nettt/nettt-tools

Composer 安装命令:

composer require nettt/nettt-tools

包简介

Deployment scripts and AI skills for Laravel and Statamic projects

README 文档

README

Deployment scripts and AI skills for Laravel and Statamic projects.

Requirements

  • PHP 8.2+
  • Laravel 12+
  • Laravel Prompts 0.3+

Installation

Step 1: Require Package

composer require nettt/nettt-tools

Step 2: Configure Site Folder

Add the required environment variable to your .env file:

REMOTE_SITE_FOLDER=your-site-folder

Step 3: Run Install Command

Always run the install command after requiring the package:

php artisan nettt:install

This command will:

  • Offer to install Laravel Boost for AI-assisted development
  • Remove legacy shell scripts (Statamic projects only)
  • Publish the configuration file
  • Add automatic post-update hook to composer scripts
  • Run boost:install as the final step

Options

# Skip confirmation prompts
php artisan nettt:install --force

# Keep backup copies of removed files
php artisan nettt:install --keep-backups

Usage

Interactive Mode

php artisan nettt:start

This will show a menu based on your environment:

Local Environment:

  • Start development (update dependencies & run build)
  • Pull content/database from production
  • Push content/database to production
  • Publish AI skills

Production Environment:

  • Run deployment tasks
  • Run optimization tasks

Command Options

# Run development tasks directly
php artisan nettt:start --dev

# Run deployment tasks (production only)
php artisan nettt:start --deploy

# Run optimization tasks (production only)
php artisan nettt:start --optimize

# Publish AI skills to .ai/skills
php artisan nettt:start --install-skills

Features

Start Development (Local Only)

Quickly starts your development environment by running:

  1. composer update - Updates PHP dependencies (also triggers boost:update via post-update hook)
  2. npm update - Updates Node.js dependencies
  3. npm run build - Builds frontend assets

Pull Content (Local Only)

Syncs content from production to your local environment using SSH/rsync:

  • Statamic: Syncs content, assets, forms, blueprints, users, and storage
  • Laravel: Syncs storage and optionally imports the database

A backup is created before syncing.

Push Content (Local Only)

Pushes local content to production using SSH/rsync.

  • Statamic: Pushes shared content directories, clears remote stache and static cache
  • Laravel: Pushes shared storage directories, optionally pushes the database

Warning: This is a destructive operation that overwrites production content!

  • Creates a remote backup before pushing
  • Requires double confirmation to proceed
  • Database push requires an additional final confirmation

Deployment (Production Only)

Handles deployment tasks based on project type:

Statamic:

  • Links shared directories (content, assets, forms, users)
  • Fixes permissions
  • Ensures public symlink
  • Runs npm install and build
  • Runs deployment tests

Laravel:

  • Links shared directories (storage/app/public)
  • Fixes permissions
  • Runs database migrations
  • Runs npm install and build
  • Runs deployment tests

Optimization (Production Only)

Caches configuration, routes, and views. For Statamic projects with static caching enabled, it also warms the cache.

Publish AI Skills

Publishes AI skills to your project's .ai/skills/ directory for use with Claude Code or similar tools.

Configuration

Add the following environment variables to your .env file:

# Required
REMOTE_SITE_FOLDER=your-site-folder

# Optional: Remote server (defaults shown)
NETTT_REMOTE_HOST=vm06.nettt.nl
NETTT_REMOTE_USER=nettt
NETTT_REMOTE_PORT=22222
NETTT_REMOTE_BASE=/srv/www/sites

# Optional: Override auto-detection
NETTT_PROJECT_TYPE=statamic  # or 'laravel'

# Optional: Git branches (defaults shown)
NETTT_MAIN_BRANCH=main
NETTT_DEVELOP_BRANCH=develop

# Required for vm06 site management (available as menu items in `nettt:start`,
# or directly via `nettt:vm06-new-site` / `nettt:vm06-change-domain`)
ENVOYER_API_TOKEN=your-envoyer-api-token

# Optional: error reporter (defaults shown)
NETTT_ERROR_REPORTER_ENABLED=true
NETTT_ERROR_REPORTER_LOCAL_ENABLED=false
NETTT_ERROR_REPORTER_FATAL_HANDLER=true
NETTT_ERROR_REPORTER_HTTP_EXCEPTIONS=false

The Envoyer API token is required for the vm06 site management commands (new site, change domain). Generate one in Envoyer under Account → API.

The vm06 commands are resumable: if a run fails partway, progress is preserved in .nettt-vm06-state.json (or .nettt-vm06-domain-change-state.json for the domain-change command) in the project root. Re-run the same command to resume from the last completed step. The state file is deleted automatically on full success and is added to .gitignore automatically. Pass --force-reset to discard stored state and start over.

Error Reporting

The package forwards uncaught exceptions to the Nettt errors service (errors.nettt.nl) so production issues are visible centrally. It is enabled by default and only sends in production and staging (in local only when NETTT_ERROR_REPORTER_LOCAL_ENABLED=true).

How it works

  • A callback is registered on Laravel's exception handler (reportable()); each reported exception is sanitised (sensitive keys redacted, only safe headers kept) and sent to https://errors.nettt.nl/api/errors.
  • For normal requests the HTTP call runs after the response (afterResponse), so it never delays the page.
  • A shutdown handler additionally catches fatal, process-terminating errors (E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR — e.g. memory exhaustion while processing a too-large image). These die before the afterResponse phase runs, so they are sent synchronously from the shutdown handler instead. On an out-of-memory fatal the handler raises memory_limit upward (never below the server's configured value) just enough to build and send the report.
  • The same exception within one request is sent only once (deduplication).
  • Delivery is resilient: a transient connection failure is retried once, and a non-2xx response is logged as an error instead of silently disappearing.

What is and isn't reported

ReportedNot reported
Uncaught application exceptions (500s)ValidationException (user input)
Fatal / OOM errors (via shutdown handler)AuthenticationException / AuthorizationException
5xx and 413 HTTP exceptions (opt-in, see below)404 / 405 and other 4xx HTTP exceptions

Safety

Every reporting path is wrapped so that a failure in the reporter can never break the request or the shutdown sequence — it falls back to a local log line. A failing or unreachable errors.nettt.nl does not affect the application beyond a brief (≤3s) synchronous wait on the rare fatal-error path.

Environment variables (defaults shown)

NETTT_ERROR_REPORTER_ENABLED=true          # master switch
NETTT_ERROR_REPORTER_LOCAL_ENABLED=false   # also report from local
NETTT_ERROR_REPORTER_FATAL_HANDLER=true    # shutdown handler for fatal/OOM errors
NETTT_ERROR_REPORTER_HTTP_EXCEPTIONS=false # also report 5xx + 413 (see warning)

NETTT_ERROR_REPORTER_HTTP_EXCEPTIONS is off by default on purpose. Enabling it calls $handler->stopIgnoring(HttpException::class), which removes all HTTP exceptions from Laravel's ignore list. The reporter then filters them so only 5xx and 413 are forwarded, but Laravel itself will start logging every 4xx (including 404/405) to the project log. Only enable this when you understand and accept that extra log volume.

Automatic Post-Update Hook

After running nettt:install or nettt:start --dev, your project's composer.json will include a post-update hook that automatically runs nettt:update after each composer update.

The nettt:update command runs boost:update to keep your AI tooling in sync. It skips this if boost:update is already in your post-update-cmd scripts.

Shared Paths Configuration

The following paths are synced/shared by default:

Statamic (shared directory):

  • content
  • public/assets
  • resources/blueprints/forms
  • resources/forms
  • resources/users
  • users

Statamic Storage (current release):

  • storage/form_data
  • storage/forms

Laravel (shared directory):

  • storage/app/public

You can add additional paths in the config file under shared.statamic_paths, shared.statamic_storage_paths, and shared.laravel_paths.

Project Type Detection

The package automatically detects whether your project is Laravel or Statamic by checking:

  1. The NETTT_PROJECT_TYPE environment variable
  2. The presence of statamic/cms in composer.json
  3. The Statamic\Statamic class

Legacy Files Removed (Statamic)

The following files are replaced by nettt-tools functionality:

Legacy FileReplaced By
scripts/deploy.shDeploymentService
scripts/pullcontent.shSyncService::pull()
scripts/pushcontent.shSyncService::push()
scripts/commit.shRemoved (no replacement)
scripts/dev.shnettt:start dev option
netttphp artisan nettt:start

License

MIT

nettt/nettt-tools 适用场景与选型建议

nettt/nettt-tools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 987 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「tools」 「laravel」 「deployment」 「statamic」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nettt/nettt-tools 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nettt/nettt-tools 我们能提供哪些服务?
定制开发 / 二次开发

基于 nettt/nettt-tools 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

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