ci4ms-mongodb

Login steps with mongodb in Codeigniter 4

Features

This is meant to be a one-stop shop for 99% of your web-based authentication needs with CI4. It includes the following primary features:

Installation

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

you must do in terminal

if you are installing to host, you must change file permissions user and group.

chown user:group codeigniter_project_file


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

mongo

use yourDatabase

db.createUser({
    user: "userName",
    pwd: passwordPrompt(),      // Or  "cleartextPassword"
    roles: [{role: "readWrite", db: "yourDatabase"}]
});

Create a config file at app/Config. File name should be MongoConfig.php.

<?php namespace Config;

use CodeIgniter\Config\BaseConfig;

class MongoConfig extends BaseConfig
{
    public $db = "kun-cms"; //your database
    public $hostname = '127.0.0.1'; //if you use remote server you should change host address
    public $userName = "beaver";
    public $password = "kun12345678";
    public $prefix = "";
    public $port = 27017; //if you use different port you should change port address
}

Move other files and change namespace.

Congratulations!


Automatic Installation

After made settings. you should go link http://site/installation follow form attributes. Finish installation automaticly must detele installation module. If not delete installation module you must follow this steps:

In preparation