Skip to content
PHP Ecosystem
Explore

Build Yii applications with AI agents

This content is not available in your language yet.

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-extensions/skill. 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-dynamicformyii2-extensions/dynamicformDynamic form rows
yii2-select2yii2-extensions/select2Select2 integration
yii2-selectizeyii2-extensions/selectizeSelectize integration
yii2-nested-setsyii2-extensions/nested-sets-behaviorNested sets behavior
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
yii3-debug-integrationyii3/debugYii3 Debug integration
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.

Bootstrap llm/skills 1.15.0 once in the application (PHP 8.2+). Package metadata declares where skills live; it does not install or enable the plugin. Create skills.json first, or use the optional initializer below:

{
"target": ".agents/skills",
"aliases": [".claude/skills"],
"auto-sync": true,
"vendor-sources": false,
"dependencies": {
"composer": {
"trusted-replace": true,
"trusted": ["yii2-extensions/skill", "yii2-extensions/psr-bridge"]
}
}
}

The common yii2-extensions/skill package supplies all twenty framework workflows, including migration, separately from yiisoft/yii2. Install it from Packagist:

Terminal window
composer config allow-plugins.llm/skills true
composer require --dev llm/skills:1.15.0 "yii2-extensions/skill:^0.1"
composer skills:show

Commit the application’s composer.lock to reproduce its resolved package revisions with composer install. Use composer update to select releases within the declared constraints. With auto-sync set to true, both commands synchronize trusted bundles automatically. Add only the exact extension package names you approve to trusted; the PSR Bridge entry above is an example. trusted-replace removes implicit trust in direct dependencies and built-in vendors. Codex, OpenCode and Copilot read .agents/skills; Claude Code uses the alias. No individual npx installation is required.

Keep one donor per skill name. When adopting the common package, remove a previous framework Git/directory source from skills.json to avoid duplicate donors. Edit bundles in their owning repositories; generated skill directories and aliases belong outside Git. composer skills:show lists donor skills and synchronization status, not every skill available on the internet or proof that an agent loaded them.

The automatic hook reports synchronization failures without failing Composer. Run composer skills:update explicitly when CI must fail on a sync error. Set auto-sync to false to disable the hook; do not rely on --no-scripts for that with Composer 2.10.3. Donor-owned files are overwritten; retired files remain until deliberate cleanup. Preview composer skills:update --clean --dry-run before cleaning generated output.

For a new skills.json, install the plugin with its hooks disabled, then initialize this PSR Bridge example:

Terminal window
composer config --no-plugins allow-plugins.llm/skills true
composer require --dev llm/skills:1.15.0 --no-interaction --no-plugins --no-scripts
composer skills:init --no-interaction --no-sync \
--target=.agents/skills --alias=.claude/skills \
--trust=yii2-extensions/psr-bridge --no-auto-sync --discovery

Before synchronizing, set vendor-sources to false and dependencies.composer.trusted-replace to true in skills.json. The initializer has no flags for these two settings; both are needed to retain the explicit trust policy above. It refuses to overwrite an existing file by default.

Review composer skills:show and composer skills:update --dry-run, then run composer skills:update. --no-sync skips the initial sync; --no-auto-sync leaves later installs and updates without automatic sync. With this setting, run composer skills:update after dependency installation or updates. To enable automatic synchronization, set auto-sync to true after reviewing the trust settings above.

For bundles without a Composer release, register a Git or local source once. For example, Docker remains an image repository, and a local checkout can supply skill changes not yet in an installed release:

Terminal window
composer skills:add yii2-extensions/docker-images --ref=main --skill=yii2-docker-environment
composer skills:add /absolute/path/to/nested-sets-behavior --skill=yii2-nested-sets

These explicit sources are trusted by declaration. With auto-sync set to true, they synchronize on later Composer operations; with false, run composer skills:update after dependency installation or updates. They are separate from installed PHP packages and are not versioned by composer.lock; pin a checked tag or commit instead of main when reproducibility is needed. Do not use self.version between repositories with unrelated versions.

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

Terminal window
npx skills@1.7.2 add yii2-extensions/skill --list
npx skills@1.7.2 add yii2-extensions/skill --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 npx 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. Framework skills are maintained in yii2-extensions/skill; extension and tool repositories own their bundles. The site imports these sources and generates the published bundles and guide pages; it keeps only framework skill navigation locally. Maintaining the 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.