Yii3. _

PHP framework for rapid development of modern applications.

These major companies have already chosen Yii 1.1 and Yii 2.0.
Yii3 takes it to the next level!

Yes, it is!

Modern rapid development

Yii3 provides powerful tools for quickly building modern web applications, including code generators and ready-made components. Integration with the latest PHP technologies allows developers to focus on business logic rather than routine tasks.

High-quality code

Yii3 promotes writing clean, maintainable code by following best practices and design patterns. The framework follows PSR standards (PHP-FIG), ensuring compatibility with other libraries and tools. Built-in tools for testing, debugging and static analysis help maintain high code quality throughout the project lifecycle.

Scales well

Yii3 is designed to handle projects of any size, from small applications to high-load enterprise systems. Built-in caching, database optimization, and efficient resource management ensure excellent performance as your application grows.

Built-in security

Yii3 provides reliable protection for web applications thanks to built-in security mechanisms that counter common threats such as XSS, CSRF and SQL injection. Regular updates and adherence to security best practices allow developers to create secure applications with minimal additional effort.

Component-based architecture

Yii3 is built on independent components that can be used together or separately:

  • Ability to use individual Yii3 packages in any projects
  • Create your own framework based on Yii3 components
  • All components follow PSR standards, ensuring excellent compatibility

Flexibility

Yii3 adapts to your needs, not the other way around:

  • Support for various application structures
  • Organize code the way that works for your team
  • Easy integration with existing projects and third-party libraries
  • Freedom to choose tools and development approaches

Everything you need, right at hand

Community driven

Developed by community for community.

17 years of experience

Rock solid solutions and a stable foundation for your projects.

Application Templates

Start instantly with production-ready templates for web applications, REST APIs, and console tools—featuring Docker support, routing, and testing setup.

Explicit DI container

Powerful and intuitive dependency injection container with automatic wiring and flexible configuration options.

Powerful DBAL

Flexible database abstraction with query builder, Active Record, migrations, and support for PostgreSQL, MySQL, SQLite, MSSQL, and Oracle.

Rich Yii Packages Ecosystem

Extensive collection of official packages for databases, caching, validation, authentication, and more—ready to use.

Worker Mode

Run Yii3 with RoadRunner, Swoole, or FrankenPHP to boost performance by eliminating framework initialization overhead.

Modern PHP

Built for PHP 8.2+ through 8.5, leveraging readonly classes, constructor promotion, attributes, strict typing, and advanced language features.

PSR Standards

Built on PSR-7, PSR-15, PSR-3, and other interfaces, allowing seamless integration with any PHP ecosystem components.

Open PHP Ecosystem

Use any Composer package, replace core implementations, integrate third-party libraries—no vendor lock-in, just standard PHP.

Battle-Tested Quality

Every package achieves ~100% coverage with PHPUnit tests, Psalm static analysis, and Infection mutation testing for uncompromising reliability.

Community driven

Yii3 was always developed by community for community. There's no single person or company who owns the framework. The most experienced members form core teams which listen community carefully and set the development course.

Community contributions are very welcome. We try to handle these as soon as possible doing reviews and providing feedback so these match overall framework quality.

Eventually, active contributors join core teams.

A friendly and helpful community is one of our goals.

17 years of experience

Yii3 accumulates experience since 2008 when the first version of Yii was released.

  • The best ideas and principles of Yii 1.1 and Yii 2.0 distilled into modern solutions.
  • Future-proof foundation that will work for decades.
  • Ability to build prototypes fast but also turn these into stable maintainable products.

Application Templates

Yii3 provides battle-tested application templates for different project types: traditional web applications, REST API services, and console utilities. Install and run in minutes without spending time on boilerplate setup.

Available templates:

Install any template instantly:

Terminal
composer create-project yiisoft/app my-project
cd my-project
make up # Docker environment starts immediately

Out-of-the-box features:

  • Docker environment with Caddy web server
  • Separate web and console entry points
  • Organized structure
  • Configured routing, middleware, DI container
  • Asset management and build tools
  • Environment-based configuration (dev/test/prod)
  • PHPUnit and Codeception test suites

Templates follow modern best practices and 12-factor methodology. Everything is yours to customize freely.

Explicit DI container

Yii3's dependency injection container eliminates boilerplate code while maintaining clarity and type safety. The container automatically resolves dependencies through constructor and method injection.

Configuration is straightforward and supports multiple declaration styles:

config/web.php
return [
// Interface to class mapping
EngineInterface::class => EngineMarkOne::class,
 
// Detailed configuration
MyServiceInterface::class => [
'class' => MyService::class,
'__construct()' => [42],
'setDiscount()' => [10],
],
 
// Factory closures
'api' => static fn(ApiConfig $config) => new ApiClient($config),
];
 
// Dependencies are automatically injected based on type hints
final readonly class MyController
{
public function __construct(
private CacheInterface $cache
) {}
}

No service locator antipatterns, no hidden dependencies—just clean, testable code with explicit contracts.

Powerful DBAL

Yii3 provides a robust database layer featuring a fluent query builder, Active Record pattern implementation, and comprehensive schema management. Work directly with queries for performance or use Active Record for convenience.

The immutable query builder offers expressive, type-safe database operations:

Query Example
$posts = $connection
->select(['id', 'title', 'created_at'])
->from('{{%posts}}')
->where(['status' => 'published'])
->andWhere(['>', 'views', 1000])
->orderBy(['created_at' => SORT_DESC])
->limit(10)
->all();

Commands provide clean APIs for data manipulation including upsert, batch operations, and transactions. Active Record delivers ORM capabilities with relations, eager loading, and automatic validation. Migrations enable version-controlled schema evolution.

Multiple database engines supported out of the box. Optionally integrate Cycle ORM or Doctrine for advanced use cases.

Rich Yii Packages Ecosystem

Yii3 provides a comprehensive ecosystem of production-ready packages covering virtually every web application need. All packages follow the same quality standards with full test coverage and PSR compliance.

  • Database & Persistence — multiple database support with query builder and ORM, schema migrations, connection pooling, and transaction management.
  • Caching Solutions — flexible caching layer with adapters for popular backends including in-memory stores, distributed caches, and file-based storage.
  • Security & Access Control — complete authentication and authorization systems with role-based access control, permission management, and secure password handling.
  • Validation — powerful validation framework with extensive built-in rules, custom validators, conditional validation, and error message formatting for user input verification.
  • Hydration — object hydration for transforming arrays into typed objects and vice versa, ensuring type safety and seamless data mapping throughout your application.
  • View Rendering — flexible template engine support with multiple rendering backends, layouts, partials, widget system, and asset management for organized frontend code.
  • Data Processing — data formatters, pagination, sorting, and data provider abstractions for consistent handling across different data sources.
  • Utilities — tools for arrays, strings, files, JSON, HTML generation, and network operations to simplify common programming tasks.

Every package is independently versioned, thoroughly documented, and available on Packagist. Install only what you need—no bloat, just solutions.

Worker Mode

Traditional PHP reinitializes the framework for every request, consuming a lot of processing resources. Yii3 supports event loop operation mode where workers handle multiple requests without reinitialization, dramatically improving performance.

The framework handles state management automatically, ensuring each request is processed in isolation while sharing the initialized context. Workers process requests independently, delivering significant performance gains without sacrificing code quality or safety.

Compatible with RoadRunner, Swoole, and FrankenPHP out of the box.

Modern PHP

Yii3 fully embraces modern PHP capabilities, supporting PHP 8.2 through 8.5 and extensively using contemporary language features for cleaner, safer, and more maintainable code.

Readonly classes with constructor property promotion eliminate boilerplate:

UserService.php
final readonly class UserService
{
public function __construct(
private UserRepository $users,
private LoggerInterface $logger,
private CacheInterface $cache,
) {}
 
public function findByEmail(string $email): ?User
{
return $this->cache->getOrSet(
"user:$email",
fn() => $this->users->findByEmail($email)
);
}
}

Strict type declarations throughout the framework catch errors at compile time. Attributes enable metadata-driven functionality. Generators optimize memory usage for large datasets. Named arguments improve configuration readability.

The codebase demonstrates modern PHP best practices, serving as a reference for writing contemporary, type-safe applications.

PSR Standards

Yii3 extensively uses PSR interfaces, enabling you to reuse what the PHP community created and even replace core implementations when needed. The framework provides flexibility without vendor lock-in.

For example, HTTP handling uses PSR-7 requests/responses and PSR-15 middleware:

PostAction.php
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
 
final readonly class PostAction
{
public function view(ServerRequestInterface $request): ResponseInterface
{
$response = $this->responseFactory->createResponse();
$response->getBody()->write('Hello!');
return $response;
}
}

Logging follows PSR-3, caching implements PSR-16, and dependency injection uses PSR-11. This means you can drop in Monolog for logging, any PSR-16 cache adapter, or integrate third-party PSR-15 middleware from the ecosystem without friction.

Standards-first architecture ensures your code stays portable and future-proof while maintaining full access to modern PHP tooling.

Open PHP Ecosystem

Yii3 embraces the entire PHP ecosystem instead of reinventing the wheel. Built on PSR standards and Composer, the framework integrates seamlessly with any PHP library without forcing proprietary solutions.

Use any Composer package:

Terminal
composer require monolog/monolog
composer require league/flysystem
composer require symfony/mailer

All packages work immediately through PSR autoloading and dependency injection. Need Monolog for logging? Doctrine for ORM? Symfony components? Just install and use them.

Replace core implementations: thanks to PSR interfaces, swap built-in components for alternatives. Use Twig instead of the default template engine, Redis cache instead of file cache, or any PSR-3 logger implementation.

Create and share packages: build reusable components as Composer packages and publish to Packagist. The framework doesn't lock you into proprietary formats—your code remains portable across projects and frameworks.

No vendor lock-in. No proprietary APIs. Just modern PHP standards enabling you to leverage the entire ecosystem's innovation.

Battle-Tested Quality

Yii3 maintains exceptional code quality standards across all packages. Every line undergoes rigorous verification through multiple layers of automated testing and analysis.

Static analysis checks every line for type correctness and potential errors, preventing runtime failures from incorrect data types or hidden bugs before they reach production.

Comprehensive unit tests cover all system components, ensuring updates and modifications won't break existing functionality. Changes are validated automatically before release.

Mutation testing verifies tests catch even subtle code behavior changes, protecting against non-obvious bugs.

This triple-layer quality assurance means your application runs on battle-tested foundation where potential issues are eliminated during development, not discovered in production.

PHP 8 & APIs

Fully documented, IDE friendly.
Ready to use with React, Vue.js or Angular.

Yii3 APIs
Yii3 APIs
~100%

Psalm

Every line of code is checked for data types and potential errors. This means your project won't have unexpected failures due to incorrect data or hidden bugs in the code.

~100%

PHPUnit

All system components are covered by unit tests. You can be sure that with updates or code changes the system will continue to work like clockwork - any problem will be caught before it reaches users.

~100%

Infection MSI

Tests successfully catch even the slightest deviations in code behavior. This ensures that your application is protected from non-obvious bugs and always works exactly as intended.

Join the growing community 

Build performant and functional
web applications with confidence.

Recognized by many framework