MongoDB, PHP, Yii Framework

MongoYii – A Yii MongoDB ORM

I had more spare time recently and decided to make an ORM for Yii.

It supports MongoDB and attempts to conform to Yiis own standards as much as possible; it is named MongoYii.

I won’t explain much more here since the repository has a pretty comprehensive readme that will describe the project fully to you:

https://github.com/Sammaye/MongoYii

Advertisements

22 thoughts on “MongoYii – A Yii MongoDB ORM

    1. I haven’t really considered it actually, I have never used IRC before and I normally spend all my time bashing people on stackoverflow lol, but I might have to drop by and see what’s happening 🙂

    1. Do you mind if I release this on my github or post it as a extension on Yii site, I will most likely add it to a util repo which people can download to get awesome addons for MongoYii

      1. All right!

        Some addtion to the docs

        — main configuration:
        ‘components’=>array(

        ‘cache’ => array(
        ‘class’=>’EMongoCache’,
        // ‘mongoConnectionId’ => ‘mongodb’,
        // ‘collectionName’ => ‘mongodb_cache’,
        ‘ensureIndex’ => true, //set to false after first use of the cache
        ),

        }

        — usage:

        // flush cache
        Yii::app()->cache->flush();

        // add data to cache
        Yii::app()->cache->set(‘apple’, ‘fruit’);
        Yii::app()->cache->set(‘onion’, ‘vegetables’);
        Yii::app()->cache->set(1, ‘one’);
        Yii::app()->cache->set(2, ‘two’);
        Yii::app()->cache->set(‘one’, 1);
        Yii::app()->cache->set(‘two’, 2);

        // delete from cache
        Yii::app()->cache->delete(1);
        Yii::app()->cache->delete(‘two’);

        // read from cache
        echo Yii::app()->cache->get(2);
        echo “”;

        // multiple read from cache
        $arr = Yii::app()->cache->mget(array(‘apple’, 1, ‘two’));

        echo “

        ";
          print_r($arr);
          echo "

        “;

        — output:

        two
        Array
        (
        [apple] => fruit
        [1] =>
        [two] =>
        )

    1. Maybe though that one is larger than the EMongoSession, I also modified the EWebUser and UserIdentity. Maybe put it as its own repo or something, gotta decide.

  1. What do you think about creating a newsletter extension later? I have some knowledge about this topic, but my English and git knowledge pure.

  2. mongo db without mx record optimalisation

    user:[
    username:’admin’
    password:{md5},
    from_mail=’admin@teszt.dev’,
    from_name=’Admin’,
    stat: [
    [year_and_month:’2013.01′, sent:27372, failed:1322]
    ]
    ]

    mails [
    [
    name_to:’valaki’,
    mail_to:’user@admin.dev’,
    groups:[‘biztosítók’],
    stat: [sent:8, failed:1],
    mx_server: ‘1.1.1.1’,
    mxweight: 22,
    ]
    ]

    newsletter: [
    [
    mail_from: ‘admin@teszt.dev’,
    name_from: ‘Admin’,
    subject: ‘minta hírlevél’,
    content_plain: ‘szöveg’,
    content_html: ‘szöveg‘,
    satus: ‘imported’,
    stat: [sent:8, failed:1]
    ]
    ]

    mail_queue: [
    [
    mail_to: ‘user@teszt.dev’,
    name_to: ‘Teszt Elek’,
    id_newsletter: {newsletter.mongoId}
    ]

    mail_log: [
    [
    status: ‘sent/failed’
    mail_to: ‘user@teszt.dev’,
    name_to: ‘Teszt Elek’,
    id_newsletter: {newsletter.mongoId}
    ]
    ]

    1. Ah I see what you mean, is this directly relatable to the core of Yii like CCache or CMessageSource etc?

      Really the MongoYii repo itself is more about core extension stuff else it starts to become bloated without need.

  3. Several years ago I didn’t use yii and I had some native php newsletter implementation. This year one of my customer asked me to develop a newsletter module to his (my yii based) webshop.
    I think it is a repeated task and most of web development use newsletter. I think the phpmailer, yii-cli and your mongoyii (or database abstract) extensions and the core yii enough to this task.
    I think the scheduler will be a cron based php-yii-script.

    1. This would be great as its own extension to the MongoYii extension but it is something that is probably best kept away from the main repo if I am honest. A proper newsletter module could get quite vast and it seems unproper to bloat the main repo with it.

      But it is an awesome idea and I really think you should work towards releasing that on your github and the yii website, I think you could get a solid user base. From having to find email modules recently I know that Yii extensions are lacking on that front.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s