search
HomePHP FrameworkYIIThe Yii3.0 era is coming, why not take a sneak peek?

The Yii3.0 era is coming, why not take a sneak peek?

Changes

Recommended: " Chuanzhi Podcast Yii Development Large Mall Project Video Tutorial

Just like when the Yii2.0 era came, Yii1.0 will eventually be gloomy. The launch of Yii3.0 version is bound to set off waves in the Yii framework. So what is the difference between Yii3.0 and Yii2.0? What changes have been made?

Yii3.0 Framework Introduction


The Yii3.0 framework is a skeleton application best suited for quick project creation.

#The framework contains basic functionality including user login/logout and contact pages. It includes all common configurations, allowing you to focus on adding new features to your application.

Directory structure

config/             包含应用配置public/             包含入口脚本,已发布的资源和其他公开可用的文件,例如favicon.ico和robots.txt
runtime/            包含运行时生成的文件
vendor/             包含依赖的第三方包
.env
.env.dist
composer.json
docker-compose.yml

Requirements


The web server supports PHP 7.1 which is the minimum requirement for the Yii3.0 framework .

Installation


If you don’t have Composer, you can install it by following the instructions on getcomposer.org.

You can then install this project template using the following command:

composer create-project --prefer-dist --stability = dev yiisoft / yii-project-template myappcd myapp

This gives you an empty project to which you can add the application template, see below on how to add these projects part.

Depending on your system, you may need to provide write permissions for ./runtime and ./public/assets

CLI application

If you want to install and run your own console The console application required for the command can be implemented by loading the yiisoft/yii-base-cli package.

composer require yiisoft/yii-base-cli

You can now run yii help to see the available commands.

API Application

If you want to create an API, you can load it by loading [yiisoft/yii-base-api](https://github.com/yiisoft/yii- base-api) package to implement

composer require yiisoft/yii-base-api
vendor/bin/yii serve -p 8081

You can access the API through http://localhost:8081/.

Web Application

Since web applications use client-side resources (such as CSS and Javascript), the resource allocation system is first selected

Option a: Asset-packagist and composer-merge-plugin (requires PHP only)

composer require "wikimedia/composer-merge-plugin"
composer config repositories.ap '{"type": "composer", "url": "https://asset-packagist.org"}'
composer config extra.merge-plugin.include "vendor/*/*/composer.assets.json"

Option b: Foxy (requires npm or yarn)

composer require "foxy/foxy:^1.0.0"

Now you can install the web application library and its dependencies Item

composer require yiisoft/yii-base-web
vendor/bin/yii serve

You should now be able to access the application at http://localhost:8080/.

You can find more available application libraries on GitHub.

Docker

Clone the repository and create an environment configuration file

cp .env.dist .env

To run the installation, create bash from the PHP image

docker-compose run --rm php bash

And run the composer command above.

Start the application stack

docker-compose up -d

Access via browser

http://docker.host:30080

Configuration


##Database

Edit the database configuration file config/db.php and add the real configuration, for example:

return [    'class' => 'yii\db\Connection',    'dsn' => 'mysql:host=localhost;dbname=yii2basic',    'username' => 'root',    'password' => '1234',    'charset' => 'utf8',
];

Tips: - Yii will not create it for you Database, this must be done manually before you can access it. - Inspect and edit other files in the config/ directory to customize the application as needed. - For information on basic application testing, see the README in the tests directory.

Tests


The tests are located in the tests directory.

Run directly from Docker image

docker run -it -v $PWD/yii-project:/app -w /app yiisoftware/yii2-php:7.2-apache bash

The above is the detailed content of The Yii3.0 era is coming, why not take a sneak peek?. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:Yii中文网. If there is any infringement, please contact admin@php.cn delete
Yii: A Strong Framework for Web DevelopmentYii: A Strong Framework for Web DevelopmentApr 15, 2025 am 12:09 AM

Yii is a high-performance PHP framework designed for fast development and efficient code generation. Its core features include: MVC architecture: Yii adopts MVC architecture to help developers separate application logic and make the code easier to maintain and expand. Componentization and code generation: Through componentization and code generation, Yii reduces the repetitive work of developers and improves development efficiency. Performance Optimization: Yii uses latency loading and caching technologies to ensure efficient operation under high loads and provides powerful ORM capabilities to simplify database operations.

Yii: The Rapid Development FrameworkYii: The Rapid Development FrameworkApr 14, 2025 am 12:09 AM

Yii is a high-performance framework based on PHP, suitable for rapid development of web applications. 1) It adopts MVC architecture and component design to simplify the development process. 2) Yii provides rich functions, such as ActiveRecord, RESTfulAPI, etc., which supports high concurrency and expansion. 3) Using Gii tools can quickly generate CRUD code and improve development efficiency. 4) During debugging, you can check configuration files, use debugging tools and view logs. 5) Performance optimization suggestions include using cache, optimizing database queries and maintaining code readability.

The Current State of Yii: A Look at Its PopularityThe Current State of Yii: A Look at Its PopularityApr 13, 2025 am 12:19 AM

YiiremainspopularbutislessfavoredthanLaravel,withabout14kGitHubstars.ItexcelsinperformanceandActiveRecord,buthasasteeperlearningcurveandasmallerecosystem.It'sidealfordevelopersprioritizingefficiencyoveravastecosystem.

Yii: Key Features and Advantages ExplainedYii: Key Features and Advantages ExplainedApr 12, 2025 am 12:15 AM

Yii is a high-performance PHP framework that is unique in its componentized architecture, powerful ORM and excellent security. 1. The component-based architecture allows developers to flexibly assemble functions. 2. Powerful ORM simplifies data operation. 3. Built-in multiple security functions to ensure application security.

Yii's Architecture: MVC and MoreYii's Architecture: MVC and MoreApr 11, 2025 pm 02:41 PM

Yii framework adopts an MVC architecture and enhances its flexibility and scalability through components, modules, etc. 1) The MVC mode divides the application logic into model, view and controller. 2) Yii's MVC implementation uses action refinement request processing. 3) Yii supports modular development and improves code organization and management. 4) Use cache and database query optimization to improve performance.

Yii 2.0 Deep Dive: Performance Tuning & OptimizationYii 2.0 Deep Dive: Performance Tuning & OptimizationApr 10, 2025 am 09:43 AM

Strategies to improve Yii2.0 application performance include: 1. Database query optimization, using QueryBuilder and ActiveRecord to select specific fields and limit result sets; 2. Caching strategy, rational use of data, query and page cache; 3. Code-level optimization, reducing object creation and using efficient algorithms. Through these methods, the performance of Yii2.0 applications can be significantly improved.

Yii RESTful API Development: Best Practices & AuthenticationYii RESTful API Development: Best Practices & AuthenticationApr 09, 2025 am 12:13 AM

Developing a RESTful API in the Yii framework can be achieved through the following steps: Defining a controller: Use yii\rest\ActiveController to define a resource controller, such as UserController. Configure authentication: Ensure the security of the API by adding HTTPBearer authentication mechanism. Implement paging and sorting: Use yii\data\ActiveDataProvider to handle complex business logic. Error handling: Configure yii\web\ErrorHandler to customize error responses, such as handling when authentication fails. Performance optimization: Use Yii's caching mechanism to optimize frequently accessed resources and improve API performance.

Advanced Yii Framework: Mastering Components & ExtensionsAdvanced Yii Framework: Mastering Components & ExtensionsApr 08, 2025 am 12:17 AM

In the Yii framework, components are reusable objects, and extensions are plugins added through Composer. 1. Components are instantiated through configuration files or code, and use dependency injection containers to improve flexibility and testability. 2. Expand the management through Composer to quickly enhance application functions. Using these tools can improve development efficiency and application performance.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool