定制 bertugfahriozer/ci4mongodblibrary 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bertugfahriozer/ci4mongodblibrary

Composer 安装命令:

composer require bertugfahriozer/ci4mongodblibrary

包简介

Codeigniter 4 MongoDB library & Common Model

README 文档

README

##Sistem Gereksinimleri

  • PHP 7.3 veya 8.0^
  • MongoDB PHP Driver 1.8^

Kurulum

Mongo Driver ve Composer'a sisteminize kurmuş olmalısınız. Kurulum için şu bağlantıları izleyin:

Bir config dosyası oluşturmalısınız. Dosya oluşturduğunuzda, php etiketi için boşlukları silin. (app/Config/MongoConfig.php)

Uzak Bağlantı için srv değişkenine yorum satırındakini veri kullanılabilir veya boş bırakılabilir. authMechanism değişkeni bağlantı yapılırken gereken güvenlik protokolünü belirtmeniz için oluşturulmuştur.

Eğer isterseniz başka bir veritabanına bağlanmak için model içinde $dbVar=new Mongo('dbName'). bu sayede tek bir Ci4 uygulaması içinde birden çok veritabanına müdehale edebilirsiniz.

<?php namespace App\Config;

use CodeIgniter\Config\BaseConfig;

class MongoConfig extends BaseConfig
{
    public $dbInfo = [];

    public function __construct()
    {
        $this->dbInfo = [
            'default' => (object)[
                'db' => '', //your database
                'hostname' => "",//127.0.0.1 if you use remote server you should change host address
                'userName' => "",
                'password' => "",
                'prefix' => '',
                'port' => "",//27017 if you use different port you should change port address
                'srv' => 'mongodb',//mongodb+srv
                //SCRAM-SHA-256 - SCRAM-SHA-1
                'authMechanism' => "SCRAM-SHA-1",
                'db_debug' => TRUE,
                'write_concerns' => (int)1,
                'journal' => TRUE,
                'read_preference' => 'primary',
                'read_concern' => 'local', //'local', 'majority' or 'linearizable'
                'ca_file'=>[]//['ca_file' => '/usr/local/etc/openssl/cert.pem']
            ]
        ];
    }
}

composer require bertugfahriozer/ci4mongodblibrary

Eğer Composer ile yükledikten sonra direkt devam etmek istiyorsanız namespace düzeni şu şekilde :

use ci4mongodblibrary\Models\CommonModel;

use ci4mongodblibrary\Libraries\Mongo;

Manuel kurulum istiyorsanız aşağıdaki adımları takip edebilirsiniz.

Codeigniter 4 projenize dosyaları taşıyabilirsiniz ve namespace değiştirmeniz gerekir =>

app/Libraries/Mongo.php,
app/Config/MongoConfig.php,
app/Models/CommonModel.php.

Codeigniter 4 MongoDB Library & Common Model

##System Requirements

  • PHP 7.3 veya 8.0^
  • MongoDB PHP Driver 1.8^

Installation

You must have Mongo Driver and Composer. Follow these links for installation:

You must create a config file. When you create file, delete spaces for php tag. (app/Config/MongoConfig.php)

For Remote Connection, the data in the comment line can be used or left blank in the srv variable. The authMechanism variable is created to specify the required security protocol when connecting.

If you want to connect to another database, $dbVar=new Mongo('dbName') in the model. In this way, you can intervene in multiple databases within a single Ci4 application.

<?php namespace App\Config;

use CodeIgniter\Config\BaseConfig;

class MongoConfig extends BaseConfig
{
    public $dbInfo = [];

    public function __construct()
    {
        $this->dbInfo = [
            'default' => (object)[
                'db' => '', //your database
                'hostname' => "",//127.0.0.1 if you use remote server you should change host address
                'userName' => "",
                'password' => "",
                'prefix' => '',
                'port' => "",//27017 if you use different port you should change port address
                'srv' => 'mongodb',//mongodb+srv
                //SCRAM-SHA-256 - SCRAM-SHA-1
                'authMechanism' => "SCRAM-SHA-1",
                'db_debug' => TRUE,
                'write_concerns' => (int)1,
                'journal' => TRUE,
                'read_preference' => 'primary',
                'read_concern' => 'local', //'local', 'majority' or 'linearizable'
                'ca_file'=>[]//['ca_file' => '/usr/local/etc/openssl/cert.pem']
            ]
        ];
    }
}

composer require bertugfahriozer/ci4mongodblibrary

If you want to continue directly after installing with Composer, the namespace layout is as follows:

use ci4mongodblibrary\Models\CommonModel;

use ci4mongodblibrary\Libraries\Mongo;

if do you want manual install you can follow these steps.

You can move files in your Codeigniter 4 project and you must change namespaces =>

app/Libraries/Mongo.php,
app/Config/MongoConfig.php,
app/Models/CommonModel.php.

bertugfahriozer/ci4mongodblibrary 适用场景与选型建议

bertugfahriozer/ci4mongodblibrary 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.29k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2021 年 05 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 bertugfahriozer/ci4mongodblibrary 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 bertugfahriozer/ci4mongodblibrary 我们能提供哪些服务?
定制开发 / 二次开发

基于 bertugfahriozer/ci4mongodblibrary 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.29k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 16
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-05-20