Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. MongoDB
  3. yii-mongodb

yii-mongodb

BSD-3-ClausePHP2.1.7

A Yii 2 extension providing MongoDB integration with ActiveRecord, Query Builder, and migration support.

Visit WebsiteGitHubGitHub
331 stars191 forks0 contributors

What is yii-mongodb?

Yii2 MongoDB is an official extension that adds MongoDB support to the Yii 2 PHP framework. It provides ActiveRecord pattern implementation for MongoDB documents, a query builder for constructing MongoDB queries, and migration tools for schema management. This allows developers to use MongoDB as a database backend while maintaining Yii's familiar development workflow.

Target Audience

Yii 2 developers who want to use MongoDB as their database backend, particularly those building applications that benefit from document-oriented data storage or need to integrate with existing MongoDB infrastructure.

Value Proposition

As an official Yii extension, it offers seamless integration with the framework's ecosystem, including full ActiveRecord support, query building that matches Yii's SQL patterns, and compatibility with Yii's migration system. It's maintained by the Yii core team ensuring reliability and framework compatibility.

Overview

Yii 2 MongoDB extension

Use Cases

Best For

  • Adding MongoDB support to existing Yii 2 applications
  • Building new Yii 2 applications with document-oriented database requirements
  • Migrating Yii 2 applications from SQL to MongoDB
  • Storing large files in MongoDB using GridFS within Yii applications
  • Managing MongoDB schema changes through Yii's migration system
  • Using ActiveRecord pattern with MongoDB documents in PHP applications

Not Ideal For

  • Projects not using the Yii 2 PHP framework
  • Applications relying heavily on deprecated MongoDB features like the 'group' command in MongoDB 4.2+
  • Teams wanting a lightweight, framework-agnostic MongoDB library for microservices or non-Yii environments

Pros & Cons

Pros

Official Yii Integration

Maintained by the Yii core team, ensuring seamless compatibility with Yii 2's ecosystem, including configuration and component management as per the README's setup instructions.

ActiveRecord for MongoDB

Enables using MongoDB documents as ActiveRecord models with validation, relations, and lifecycle events, mirroring Yii's SQL workflow for developer familiarity.

Comprehensive Query Builder

Provides a fluent, chainable interface for building MongoDB queries, similar to Yii's SQL query builder, allowing complex queries without raw MongoDB syntax.

Migration and GridFS Support

Includes tools for database migrations and GridFS integration, extending Yii's data management capabilities to MongoDB for schema changes and large file storage.

Cons

Framework Dependency Lock-in

Exclusively designed for Yii 2, making it useless for projects on other PHP frameworks and limiting flexibility if migrating away from Yii.

Deprecated Feature Challenges

The README notes known issues with the 'group' command in MongoDB 4.2+, indicating potential gaps in supporting deprecated or evolving MongoDB features.

Setup and Version Requirements

Requires specific versions of the MongoDB PHP Extension (1.20.1+) and MongoDB server (4.0+), which can complicate deployment and maintenance in diverse environments.

Frequently Asked Questions

Quick Stats

Stars331
Forks191
Contributors0
Open Issues29
Last commit3 months ago
CreatedSince 2013

Tags

#database-driver#hacktoberfest#query-builder#yii2#yii#nosql#activerecord#database-migrations#mongodb#gridfs#php-orm

Built With

P
PHP

Links & Resources

Website

Included in

MongoDB2.6k
Auto-fetched 3 hours ago

Related Projects

laravel-mongodblaravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)

Stars7,079
Forks1,440
Last commit6 days ago
MongoDBMongoDB

The Official MongoDB PHP driver

Stars921
Forks214
Last commit11 days ago
mongo-php-adaptermongo-php-adapter

:link: [Deprecated] Adapter to provide ext-mongo interface on top of mongo-php-library

Stars464
Forks132
Last commit9 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub