Ir al contenido
PHP Ecosystem
Explore

Build Yii applications with AI agents

Esta página aún no está disponible en tu idioma.

Use these skills when creating or changing a Yii 22.0 application. They describe application code conventions, controllers, models, migrations, forms, tests, and extension widgets. They are not instructions for developing the framework or maintaining this documentation site.

  1. Create the Yii 22.0 application and open its root directory in the coding agent.
  2. Install yii2-framework for setup, or select a focused framework subsystem skill for an existing application. Add a package-owned skill when its workflow applies.
  3. Confirm that the client discovers the installed skill, then activate it explicitly for the first task.
  4. Start with a small change. Give the agent a known Markdown page when possible; use llms.txt only to discover documentation when the relevant page is not known.
  5. Review the changed files and run the application’s own tests, static analysis, and migration checks before accepting the result.

Follow Installing Yii, then open the new application’s directory in your coding agent. Keep its existing project instructions and code standards. The skill supplies Yii-specific guidance; it does not replace your application’s requirements or permissions.

The framework skill follows the yiisoft/yii2-app-basic template’s 22 branch: PHP 8.3+, Composer autoloading, src/ for application classes, resources/views/ for views, and public/ as the Web root.

Install from the application’s root, not inside Composer vendor/. Choose the workflow the application uses:

Each skill has its own page in the corresponding Yii2 navigation section. These pages render the maintained SKILL.md instructions; select the workflow you need, then follow the installation steps below.

SkillWorkflow
yii2-frameworkApplication setup
yii2-upgrade-22Upgrade to Yii 22.0
yii2-autoload-diAutoloading and DI
yii2-cachingCaching
yii2-console-commandsConsole commands
yii2-data-widgetsData widgets
yii2-database-migrationsQueries and migrations
yii2-events-behaviorsEvents and behaviors
yii2-files-uploadsFiles and uploads
yii2-forms-validationForms and validation
yii2-i18n-formattingTranslation and formatting
yii2-logging-errorsLogging and errors
yii2-mailMail
yii2-mutexMutex coordination
yii2-rest-apisREST APIs
yii2-security-accessIdentity and access
yii2-sessions-cookiesSessions and cookies
yii2-testing-fixturesTests and fixtures
yii2-views-assetsViews and assets
yii2-web-routing-actionsRouting and actions

All framework skills are owned by yii2-framework/docs. Each subsystem bundle carries its shared conventions. Use the local checkout procedure for changes not yet published.

SkillOwning repositoryGuide
yii2-bootstrap6-widgetsyii2-extensions/bootstrap6Bootstrap 6
yii2-filepond-uploadsyii2-extensions/filepondFilePond uploads
yii2-psr-bridge-workeryii2-extensions/psr-bridgeWorker lifecycle
yii2-roadrunner-workeryii2-extensions/road-runnerRoadRunner worker
yii2-frankenphp-workeryii2-extensions/franken-phpFrankenPHP worker
yii2-debug-inspectionyii2-extensions/debugDebug inspection
yii2-phpstan-analysisyii2-extensions/phpstanStatic analysis
yii2-inertia-integrationyii2-extensions/inertiaInertia integration
yii2-localeurls-configurationyii2-extensions/localeurlsLanguage URLs
yii2-docker-environmentyii2-extensions/docker-imagesDocker environment

The Basic Project Template uses Bootstrap 5, so select the Bootstrap 6 skill only when that extension is installed. Installing any skill does not install or switch PHP packages.

Use the verified skills CLI version 1.7.2. List the chosen source before installing:

Terminal window
npx skills@1.7.2 add yii2-framework/docs --list
npx skills@1.7.2 add yii2-framework/docs --skill yii2-framework --agent codex

For a package, replace the repository and skill with the matching row above. The installer reads the source’s default branch; unpublished local changes require its absolute checkout path instead of the public repository. Keep project scope. Use --agent claude-code or --agent opencode for those clients. Recheck options before using another installer version.

Copy the owning repository’s complete skills/<name>/ directory, including referenced resources, into the client path below. Retain the <name>/SKILL.md structure and one copy per client. The portable Agent Skills format is separate from client hooks, permissions and activation rules. The site distributes unchanged package bundles under /docs/skills/<name>/; its generated index records source refs and resource hashes. Contributor source ownership explains regeneration.

Installation, discovery, activation and the task result are separate checks. A copied skill proves installation; a client catalog proves discovery. Neither establishes correct execution.

ClientProject pathExplicit activationNative evidence to retain
Codex.agents/skills/<name>/SKILL.md$<name> or skill pickerDiscovered workspace origin, matching loaded body, file changes and acceptance results.
Claude Code.claude/skills/<name>/SKILL.md/<name>Native skill-tool event, consulted pages, file changes and acceptance results.
OpenCode.opencode/skills/<name>/SKILL.md or .agents/skills/Request its native skill tool by nameAvailable-skills list, skill-tool event and functional results for the selected provider/model.
GitHub Copilot in VS Code.github/skills/<name>/SKILL.md or .agents/skills//<name> in agent chatClient discovery and task outputs; installer support alone does not establish activation.
Amp.agents/skills/<name>/SKILL.mdAsk it to load the skillamp skills list, loading trace and task results.

The installer chooses .agents/skills/ for Codex, OpenCode, Copilot and Amp, and .claude/skills/ for Claude Code. When using the Codex extension inside VS Code, follow the Codex row. Use separate workspaces for explicit activation and automatic selection, and include a negative task where the skill should remain unused.

Start with a small task, inspect the changed files, and run the application’s existing checks. A listed Composer script is not proof that its configuration or tests exist; see development checks.

Choose the narrowest resource that covers the task:

NeedResource
A known guide page or API typeFetch its <page>/index.md Markdown directly.
An unknown topicSearch llms.txt, then fetch the matching pages.
Several related pagesUse a bundle linked by llms.txt when the task genuinely crosses that topic or namespace.

llms.txt is a proposed public convention for documentation discovery, not a protocol that every agent or client loads automatically. Give the URL to the agent or ask it to fetch the index when discovery is needed. Do not attach or reload the complete index when the task already identifies its pages.

The _llms-txt/<name>.txt route, its bundle names, and the way large groups are split are conventions of this site, not requirements of the llms.txt proposal. Always take a bundle URL from the current index instead of constructing or permanently storing it. For example, the current build may list getting-started.txt, extensions-<package>.txt, or API namespace bundles such as api-yii2-di.txt. Later chunks are named after their first page, namespace, or type and may change as the documentation grows.

Published multi-page bundles are limited to about 120 kB, estimated as roughly 30k tokens at four bytes per token. The size shown in llms.txt is a planning estimate, not a measurement from a particular model’s tokenizer. A bundle is therefore a budgeted convenience, not a guarantee that it fits every model or task. The index and bundles contain English pages only.

The bulk exports are for retrieval and indexing pipelines, not ordinary interactive tasks:

ResourceContents and limits
llms-full.txtEvery English page except the API reference. It is too large to load whole into a normal task.
llms-small.txtAn abridged non-API export that removes most non-warning blockquotes. It remains large and is intentionally lossy.

The abridged export keeps warnings, but it can remove notes, tips, information blocks, ordinary quotations, and other context that matters to an implementation. Use focused page Markdown or the full export when completeness matters.

The API reference is generated from PHPDoc: the framework’s 22.0 branch and the configured extension sources. Each type has a page with stable member anchors such as #property-options and #method-widget.

For signatures, types, and defaults, use a filtered entry from reference/yii2.json or reference/<package>.json. Download and filter the catalog outside the model context, for example with jq:

Terminal window
curl -fsS https://yii2-framework.github.io/docs/reference/yii2.json \
| jq '.types["yii\\base\\Widget"].methods.widget'

Check the catalog schema for other fields. A complete catalog can be large, and even an individual class can have many inherited members. Prefer a single method or property when that answers the question; use the guide when behavior or examples are needed.

Append index.md to a page URL:

  • HTML: https://yii2-framework.github.io/docs/guide/structure-widgets/;
  • Markdown: https://yii2-framework.github.io/docs/guide/structure-widgets/index.md.

Markdown contains the title, description, and page body. Relative page links point to Markdown versions; absolute URLs from the source stay unchanged. The HTML page announces its Markdown URL with <link rel="alternate" type="text/markdown">.

Translated content also has Markdown URLs, for example /docs/ja/guide/start-hello/index.md. For a page shown through English fallback in another locale, use its declared alternate URL; do not assume the locale-prefixed Markdown file exists.

The page menu can copy Markdown, open the Markdown URL, or open an assistant with that URL in its prompt. Passing a URL does not prove the assistant fetched it; check its retrieved context when accuracy matters.

HTML pages declare the documented version and build date in <meta name="docs:version"> and <meta name="docs:build-date">, and include JSON-LD (TechArticle and BreadcrumbList). The llms.txt header also states the version and build date. Markdown page bodies do not currently include those HTML metadata fields.

The repository’s AGENTS.md explains how agents consume the site. skills/ owns the framework application and subsystem skills; extension packages own their skills and the site generates their distribution bundles; maintaining this site uses the separate contributor documentation.

The Extensions navigation and llms.txt list packages present in this build. Guides, reference pages, and examples are synced from their package sources. Match the selected documentation to the package state being inspected; a site version label or skill bundle checksum alone does not establish that its API matches an installed dependency.

For packages with demos, including Bootstrap 6 and FilePond, example snippets are rendered by a Yii 22.0 application into static pages at /docs/demos/<package>/<slug>.html. HTML examples offer Preview, PHP, and HTML tabs. Markdown and bundles retain the code without embedding demo UI. A build using local sources can differ from the public site.

Bootstrap and AI documents Bootstrap’s own agent resources. Use the Yii extension skill for its PHP widgets, item objects, and enums; the upstream Bootstrap documentation covers the underlying CSS and JavaScript.

  • The GitHub Pages site is static: it does not provide Accept: text/markdown negotiation or a hosted MCP server;
  • use the explicit /docs/llms.txt URL; host-root discovery files are not published by this repository;
  • this documentation records verified installation behavior separately from untested client and model behavior.