Laravel Post2Site
Laravel Post2Site is a Laravel package that gives a website the content-publishing API N2N Post2Site needs, so an AI assistant can write articles into the site's own content system. The package handles API keys, saved drafts, content validation, image uploads, preview links and publishing after confirmation; it can create new content and, where the adapter supports it, update existing content, and it provides IndexNow notifications to tell search engines after publishing. Developers connect the site's own content structure and pages through a single adapter, and the repository includes a runnable blog example. It supports Laravel 12 and Laravel 13.
What it does
N2N Post2Site lets an AI assistant write articles for a website, but the website has to provide a content API the assistant can work with. Laravel Post2Site provides that API for Laravel sites. The package handles the general parts of the publishing workflow: API keys, saved drafts, content validation, image uploads, preview links and publishing after confirmation. Which content types and fields the site has, which rules apply, how previews look and what publishing writes is decided by the developer in a single adapter class. Articles end up in the site's existing content system rather than in a separate CMS.
Main features
- API keys for assistants. A single command creates a named key for each assistant, optionally with an expiry date; only a hash of the key is stored in the database.
- Versioned drafts. Drafts are kept in the package's own tables, separate from published content, and every change raises the draft's version number. A draft can create new content or, where the adapter supports it, update an existing item.
- Validation and duplicate checks. Drafts are checked against rules defined by the site, and the result lists, field by field, the problems that block publication and the warnings. The site can also check new content for overlap with existing content.
- Images and previews. Images the user has selected can be uploaded within the file types and sizes the site allows, and every draft can be viewed through a preview link before it goes live.
- Publishing under the site's control. A draft is published only with explicit confirmation and, once published, can no longer be changed or published again through the API. Publication status, date and author are set by the site, not by the assistant, and the API offers no way to delete content.
- Search engine notification. An IndexNow notifier is included, which the site can call after publishing to tell search engines about new or updated pages.
Who it is for
Laravel developers who run their own website or blog and want an AI assistant, working through N2N Post2Site, to write articles straight into the site's existing content system.
What you need
- A Laravel 12 application on PHP 8.2 or later, or a Laravel 13 application on PHP 8.3 or later.
- An adapter class that connects the package to the site's content model. The repository includes a runnable example: a simple blog with its data model, database table, adapter, signed preview link and public page.
- Install the package with Composer, run the database migrations, create an API key and register the adapter in the configuration, as shown below. Then enter the site's API address and this key in N2N Post2Site.
Laravel Post2Site is open source under the MIT license.
Install
composer require n2ns/laravel-post2site
php artisan migrate
php artisan vendor:publish --tag=post2site-config
php artisan post2site:key "My assistant"
Bind your adapter (config/post2site.php)
'bindings' => [ 'adapter' => App\Post2Site\BlogPostAdapter::class, ],