定制 n2ns/laravel-post2site 二次开发

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

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

n2ns/laravel-post2site

Composer 安装命令:

composer require n2ns/laravel-post2site

包简介

Laravel backend package for the N2N Post2Site Content Publishing API Contract.

README 文档

README

Version Total Downloads License PHP Version Laravel Version Support

Laravel backend package for the N2N Post2Site Content Publishing API Contract. It lets a Laravel site securely accept content from the n2n-post2site MCP client.

It provides protected publishing routes, package-owned staging tables for drafts and translations, optional configurable publishing into host Eloquent models, custom PublicationTarget adapters for complex sites, and optional IndexNow submission after posts are published.

The package is generic: content_scope is opaque kind:key metadata, and URL shape, scope validation, scope context, the publish target, and indexing are all host-bindable contracts. No host-specific categories are baked in.

Requirements

  • PHP 8.2+
  • Laravel 12 or 13

Installation

composer require n2ns/laravel-post2site
php artisan vendor:publish --tag=post2site-config
php artisan vendor:publish --tag=post2site-migrations
php artisan migrate
php artisan post2site:key "Production MCP"

The command prints the plaintext API key once — store it as the MCP client's N2N_API_KEY. Point the client's CONTENT_API_BASE_URL at https://your-host/<route_prefix> (default route prefix api/v1/mcp).

Publishing modes

Set POST2SITE_PUBLISHING_MODE (or post2site.publishing.mode):

  • review (default) — mark drafts published in the staging tables with zero host code. The public link is generated from public_url.pattern.
  • configurable — map fields to a host Eloquent model via config; no PHP class needed.
  • adapter — bind a custom PublicationTarget for relations, taxonomy, external CMS, etc.

See the Host Integration Guide for each mode.

Key behavior

  • Auth — database-driver API keys are stored as deterministic SHA-256 hashes and matched via a unique index (O(1)); the static driver compares a single configured key.
  • Rate limiting — every route is throttled. Tune via POST2SITE_RATE_LIMIT (max,minutes, default 60,1).
  • Search?q= uses a FULLTEXT index on MySQL/MariaDB (created by the migration on those drivers) and falls back to LIKE elsewhere (e.g. SQLite).
  • content_scope — optional kind:key; required for the types in content.scoped_types (default ['guide']) and prohibited for others. Kinds and key resolution are host-configurable.

Extension contracts

Bound from post2site.bindings and overridable: PostRepository, PublicationTarget, PublicUrlResolver, ContentScopeValidator, ScopeContextProvider, IndexingNotifier. See Architecture.

Testing

composer test       # PHPUnit
composer pint:test  # code style

Documentation

📄 License

This project is licensed under the MIT License.

Built by N2NS Lab, the open-source lab of datafrog.io for practical AI developer tools.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固