muhammedkamel / lumen-doctrine-mongodb-odm by muhammedkamel
forked from digiaonline/lumen-doctrine-mongodb-odm

Doctrine MongoDB ODM module for the Lumen PHP framework.
4,330
1
2
Package Data
Maintainer Username: muhammedkamel
Maintainer Contact: muhamed.kamel.elsayed@gmail.com (Mohamed Kamel)
Package Create Date: 2018-09-29
Package Last Update: 2018-10-07
Language: PHP
License: MIT
Last Refreshed: 2024-04-26 03:16:58
Package Statistics
Total Downloads: 4,330
Monthly Downloads: 92
Daily Downloads: 3
Total Stars: 1
Total Watchers: 2
Total Forks: 1
Total Open Issues: 0

Lumen Doctrine MongoDB ODM

Doctrine MongoDB ODM module for the Lumen PHP framework Forked from (https://packagist.org/packages/nordsoftware/lumen-doctrine-mongodb-odm) package.

Requirements

  • PHP >= 7.2

Usage

Install through Composer

Run the following command to install the package:

composer require muhammedkamel/lumen-doctrine-mongodb-odm

Register the Service Provider

Add the following line to bootstrap/app.php:

$app->register('MuhammedKamel\Lumen\Doctrine\ODM\MongoDB\DoctrineServiceProvider');

You can now use the DocumentManager facade where needed.

Configure

Create config/odm.php into config and modify according to your needs. Check base class under src/Config/Config.php

Example of config/mongodb.php


<?php

return [
    'mapping'         => 'xml',
    'paths'           => [
        base_path('some/Domain/Path/To/Your/Infrastructure/Resources/ODM'),
        base_path('some/App'),
    ],
    'proxy'           => [
        'directory' => storage_path('doctrine/proxies'),
    ],
    'hydrator'        => [
        'directory' => storage_path('doctrine/proxies'),
    ],
];

Create config/mongodb.php into config and modify according to your needs.

Example of config/mongodb.php


<?php

return [
    'default' => env('MONGODB_DB_CONNECTION', 'mongodb'),
    'connections' => [
        env('MONGODB_DB_CONNECTION', 'mongodb') => [
            'host' => env('MONGODB_DB_HOST', 'localhost'),
            'database' => env('MONGODB_DB_DATABASE', 'forge'),
            'username' => env('MONGODB_DB_USERNAME', 'forge'),
            'password' => env('MONGODB_DB_PASSWORD', ''),
            'timezone' => env('MONGODB_DB_TIMEZONE', '+00:00'),
        ]
    ],
];

Run Artisan

Run php artisan and you should see the new commands in the odm:* namespace section.

Contributing

Please note the following guidelines before submitting pull requests:

License

See LICENSE.