Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 8, 2026

Demonstrates how to implement a Yii2 basic application template style structure in Yii3 for developers who prefer the familiar, simple organization of Yii2 basic app.

Changes

  • New cookbook recipe (src/cookbook/yii2-basic-to-yii3.md) covering:

    • Target directory structure organized like Yii2 basic app (controllers in Controller/, models in Model/, etc.)
    • Implementation guide for 12 core features with practical Yii3 examples
    • Controllers, routing, views, layouts, models, form models, console commands
    • Configuration organization, database access, assets, and authentication
    • Complete example structure showing the final application layout
    • Tips for organizing code and key concepts (dependency injection, PSR-7, immutability)
  • Navigation updates: Added recipe to cookbook index and VitePress sidebar configuration

Example Implementation

Controllers handle HTTP requests in src/Controller/:

<?php
declare(strict_types=1);

namespace App\Controller;

use Psr\Http\Message\ResponseInterface;
use Yiisoft\Yii\View\Renderer\ViewRenderer;

final class SiteController
{
    public function __construct(
        private ViewRenderer $viewRenderer
    ) {
        $this->viewRenderer = $viewRenderer->withController($this);
    }

    public function index(): ResponseInterface
    {
        return $this->viewRenderer->render('index');
    }
}

The recipe shows how to structure a Yii3 application using dependency injection and PSR-7 while maintaining the familiar directory organization of Yii2 basic app.

Original prompt

This section details on the original issue you should resolve

<issue_title>A cookbook reciple about implementing Yii2 basic app structure with Yii3</issue_title>
<issue_description>### Description

Need a cookbook explaining how to replicate Yii2 https://github.com/yiisoft/yii2-app-basic using Yii3 step by step.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 8, 2026 20:57
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Copilot AI changed the title [WIP] Add cookbook for Yii2 app structure using Yii3 Add cookbook recipe for replicating Yii2 basic app structure with Yii3 Jan 8, 2026
Copilot AI requested a review from samdark January 8, 2026 21:01
@samdark
Copy link
Member

samdark commented Jan 8, 2026

@copilot That should not be an article about migration from Yii2 to Yii3 or a comparison of these two. It should be about using the same structure as in Yii2 but in Yii3.

Co-authored-by: samdark <47294+samdark@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 8, 2026

@copilot That should not be an article about migration from Yii2 to Yii3 or a comparison of these two. It should be about using the same structure as in Yii2 but in Yii3.

I've rewritten the cookbook recipe to focus on implementing Yii2 basic app structure in Yii3, rather than being a migration/comparison guide. The document now shows how to organize Yii3 code using the familiar Yii2 basic app structure (controllers in Controller/, models in Model/, etc.) without comparing the frameworks side-by-side.

Changes in commit 358178d:

  • Removed "Understanding the differences" section
  • Removed all "Yii2 vs Yii3" comparison code blocks
  • Focused purely on implementation with practical Yii3 examples
  • Added note that this is one organizational approach among many available in Yii3

Copilot AI changed the title Add cookbook recipe for replicating Yii2 basic app structure with Yii3 Add cookbook recipe for implementing Yii2 basic app structure with Yii3 Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A cookbook reciple about implementing Yii2 basic app structure with Yii3

2 participants