agents/templates

AgentsPHP templates

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:composer-plugin

pkg:composer/agents/templates

dev-master / 0.1.x-dev 2026-01-23 16:22 UTC

This package is auto-updated.

Last update: 2026-01-23 16:22:22 UTC


README

AgentsPHP Templates is a Composer-based template distribution system for PHP projects. It enables developers to sync AI assistant configuration files (Claude, Cursor IDE rules), code scaffolding templates, and project boilerplate from packages directly into their projects.

Key features:

  • Sync templates via composer templates --template vendor/package/template
  • Automatic syncing on composer update via hooks
  • Support for custom template packages
  • Conflict detection for existing files
┌───────────────────────────┐     composer templates      ┌─────────────────────┐
│   Template Package        │    ─────────────────────►   │   Your Project      │
│                           │                             │                     │
│  vendor/package/          │                             │  project/           │
│  └── templates/           │                             │  ├── .cursor/       │
│      └── my-template/     │         %cwd%               │  │   └── rules/     │
│          ├── template.json│   ──────────────►           │  ├── .claude/       │
│          └── *.stub       │                             │  └── src/           │
└───────────────────────────┘                             └─────────────────────┘

Installation

The recommended way to is via Composer:

composer require agents/templates

This library requires PHP 8.2 or higher.

Quick Start

  1. Install the package via Composer
  2. Configure automatic syncing in your composer.json:
{
    "require": {
        "php": ">=8.2"
    },
    "require-dev": {
        "agents/templates": "^0.1.0"
    },
    "scripts": {
      "post-update-cmd": [
        "@composer agents:templates --template agents/templates/demo --override"
      ]
    },
    "config": {
      "allow-plugins": {
        "agents/templates": true
      }
    }
}
  1. Run composer update to automatically sync template, or use the commands manually via composer templates.

Console

You can call the command directly via Composer:

# Command
composer agents:templates --template {vendor}/{package}/{path}/{template}

# For example
composer agents:templates --template agents/templates/templates/fx
Option Short Description
--template -t Template name (vendor/package/template)
--override -o Skip confirmation for existing files
--target Target directory (default: cwd)

Templates

Template Description
agents/templates/demo Minimal example with AGENTS.md for PHP projects
agents/templates/fx Full AgentsPHP stack: Claude/Cursor configs, CQRS patterns, API templates

Custom Template

Templates are defined by a template.json file that specifies which files to sync.

Template Structure

Templates follow the composer package structure vendor/package/template:

acme/                           # vendor
└── ai-templates/               # package
    ├── composer.json
    └── templates/
        └── api-project/        # template name
            ├── template.json
            ├── rules.md.stub
            └── config/
                └── settings.json.stub

To use this template: --template acme/ai-templates/api-project

Minimal template.json

{
  "name": "my-template",
  "files": {
    "readme": {
      "input": "%cwd%/README.md.stub",
      "output": "README.md"
    }
  }
}

Example

See the playground for a working example using this template system.