Search by

Shared Yii2 scaffold with standalone actions, authentication, RBAC, mail, views, and CLI tooling.

Package info

github.com/yii2-framework/starter

Type:yii2-scaffold

pkg:composer/yii2-framework/starter

Statistics

Installs: 198

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

dev-main / 0.1.x-dev 2026-12-06 14:49 UTC

This package is auto-updated.

Last update: 2026-12-06 14:49:45 UTC


README

Yii Framework

Starter

Build Coverage PHPStan

yii2-framework/starter is a reusable Yii2 application scaffold. It provides standalone web actions, user authentication, RBAC configuration, migrations, mail templates, semantic PHP views, console tooling, and secure web entry points.

Feature overview

How it works

This package has Composer type yii2-scaffold. The php-forge/scaffold plugin copies the paths declared in scaffold.json into the consumer project. The resulting files belong to the consumer and can be inspected, customized, or ejected from scaffold tracking.

The scaffold distinguishes between two modes used by this provider:

  • replace: updates an unmodified file and skips a file changed by the consumer.
  • preserve: creates a missing file but never overwrites an existing one.

See the scaffold workflow for update and ownership commands.

Requirements

  • PHP >=8.3. On PHP 8.6 add --ignore-platform-req=php to the Composer commands until ezyang/htmlpurifier, a requirement of Yii 22.0, allows it.
  • PHP ctype support, supplied by the extension or a Composer-compatible polyfill.
  • Composer ^2.10.
  • Yii ^22.0@dev.
  • Scaffold plugin ^0.4 in the consumer project.

Quick start

Create an empty project directory with this composer.json:

{
    "name": "my-company/my-app",
    "type": "project",
    "minimum-stability": "dev",
    "prefer-stable": true,
    "require": {
        "php": ">=8.3",
        "yii2-framework/starter": "^0.1@dev",
        "php-forge/scaffold": "^0.4"
    },
    "autoload": {
        "psr-4": {
            "app\\": "src"
        }
    },
    "extra": {
        "scaffold": {
            "allowed-packages": [
                "yii2-framework/starter"
            ]
        },
        "yii\\composer\\Installer::postCreateProject": {
            "setPermission": [
                {
                    "runtime": "0775",
                    "public/assets": "0775",
                    "yii": "0755"
                }
            ]
        },
        "yii\\composer\\Installer::postInstall": {
            "generateCookieValidationKey": [
                "config/params.php"
            ]
        }
    },
    "config": {
        "allow-plugins": {
            "php-forge/scaffold": true,
            "yiisoft/yii2-composer": true
        }
    },
    "scripts": {
        "post-create-project-cmd": [
            "yii\\composer\\Installer::postCreateProject",
            "yii\\composer\\Installer::postInstall"
        ],
        "post-install-cmd": [
            "yii\\composer\\Installer::postInstall"
        ],
        "post-update-cmd": [
            "yii\\composer\\Installer::postInstall"
        ]
    }
}

Install, configure the seeded administrator before migration, and start the application:

composer install
./yii migrate
php -S localhost:8080 -t public public/router.php

Open http://localhost:8080. The default database is runtime/db.sqlite.

What is included

src/
├── commands/                 Console command example
├── migrations/               User table and administrator seed
└── usecases/
    ├── shared/               CSRF filter, user model, and view adapters
    ├── site/                 Home, about, contact, and error actions
    └── user/                 Authentication, recovery, and administration actions
config/                       Web, console, database, and application parameters
rbac/                         PhpManager roles, rules, and assignments
resources/
├── mail/                     HTML and text mail templates
└── views/                    Complete layouts and site/user PHP views
public/                       Web entry point, router, images, and asset directory
runtime/.gitignore            Runtime directory placeholder
yii                           Console entry point

The bundled views generate semantic HTML through UI Awesome packages. The provider intentionally does not impose a CSS framework, JavaScript runtime, or asset build pipeline. See presentation customization for styling, view ownership, and alternate renderer options.

Security before deployment

The default administrator credentials, SQLite database, and file-based mail transport are development conveniences. Complete the production checklist before exposing a generated application.

Documentation

Practical guides for installing, configuring, updating and testing an application generated from this scaffold.

AI assistance

AI agents: read the documentation index and fetch the Markdown version of a page by appending index.md to its URL. The AI agents guide covers skill installation, client setup and verification.

The hosted documentation covers Yii 22.0. If it does not match the installed revision or is unavailable, use the repository guides, the skill source, the source PHPDoc and the changelog.

Package information

PHP Yii 22.0.x

Project status

PHPStan Level Max Quality

Security

OpenSSF Scorecard Zizmor

Built with AI

Built with Claude Code Built with Codex Reviewed by CodeRabbit

License

This package is released under the BSD 3-Clause License.