|
| 1 | +# Contentstack PHP SDK – Agent guide |
| 2 | + |
| 3 | +**Universal entry point** for anyone automating or assisting work in this repo—AI agents (Cursor, Copilot, CLI tools), reviewers, and contributors. Conventions and detailed guidance live in **`skills/*/SKILL.md`**, not in editor-specific config, so the same instructions apply whether or not you use Cursor. |
| 4 | + |
| 5 | +## What this repo is |
| 6 | + |
| 7 | +- **Name:** [contentstack-php](https://github.com/contentstack/contentstack-php) |
| 8 | +- **Purpose:** PHP library for the Contentstack **Delivery API**—stack initialization, content types, entries, assets, queries, sync, live preview config, and RTE rendering via the optional **`contentstack/utils`** package. |
| 9 | +- **Out of scope:** This package is not the Management API client; it focuses on read/delivery patterns documented in the SDK README. |
| 10 | + |
| 11 | +## Tech stack (at a glance) |
| 12 | + |
| 13 | +| Area | Details | |
| 14 | +|------|---------| |
| 15 | +| Language | PHP (see `composer.json` `require.php`; supports legacy 5.5+ per package) | |
| 16 | +| Layout | PSR-4 `Contentstack\` → `src/`; helper `src/Support/helper.php` | |
| 17 | +| Tests | PHPUnit 10 → `test/` (`phpunit.xml`) | |
| 18 | +| Docs | Doctum → `composer run generate:docs` (`config.php`) | |
| 19 | +| Dependency | `contentstack/utils` for `Utils`, `Option`, RTE rendering helpers | |
| 20 | + |
| 21 | +## Commands (quick reference) |
| 22 | + |
| 23 | +```bash |
| 24 | +composer install |
| 25 | +composer test |
| 26 | +# or: vendor/bin/phpunit |
| 27 | +composer run generate:docs |
| 28 | +``` |
| 29 | + |
| 30 | +Coverage and reports (when configured in `phpunit.xml`) write under `./tmp/`. |
| 31 | + |
| 32 | +## Where the real documentation lives: skills |
| 33 | + |
| 34 | +Read these **`SKILL.md` files** for full conventions—**this is the source of truth** for implementation and review: |
| 35 | + |
| 36 | +| Skill | Path | What it covers | |
| 37 | +|-------|------|----------------| |
| 38 | +| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Branches, CI expectations, Composer test/docs, PR notes | |
| 39 | +| **Contentstack PHP SDK / Utils** | [`skills/contentstack-utils/SKILL.md`](skills/contentstack-utils/SKILL.md) | `Contentstack::Stack`, `Stack`, queries, entries, assets, regions, `contentstack/utils`, semver | |
| 40 | +| **PHP style & repo layout** | [`skills/php-style/SKILL.md`](skills/php-style/SKILL.md) | PSR-4, namespaces, docblocks, `src/` layout, PHP version constraints | |
| 41 | +| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | PHPUnit, `test/` layout, constants/helpers, credentials hygiene | |
| 42 | +| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist (API, errors, deps/SCA, tests), Blocker/Major/Minor | |
| 43 | +| **Framework / build** | [`skills/framework/SKILL.md`](skills/framework/SKILL.md) | `composer.json`, autoload, Doctum, optional CI workflows | |
| 44 | + |
| 45 | +An index with short “when to use” hints is in [`skills/README.md`](skills/README.md). |
| 46 | + |
| 47 | +## Using Cursor |
| 48 | + |
| 49 | +If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **`AGENTS.md`**—same source of truth as everyone else; no separate `.mdc` rule files. |
0 commit comments