Database [neo4j] not configured

neo4j-driver

(Mau Moraca) #1

I want to connect Lumen PHP Framework to neo4j using NeoEloquent OMG but when I execute this command:

php artisan make:migration create_author_table

in console appear this message:

Database [neo4j] not configured.

These are my configurations:

.env

APP_ENV=local
APP_DEBUG=true
APP_KEY=
APP_TIMEZONE=UTC

LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=

DB_CONNECTION=neo4j
DB_HOST=127.0.0.1
DB_PORT=7474
DB_DATABASE=neo4j
DB_USERNAME=neo4j
DB_PASSWORD=secret

CACHE_DRIVER=file
QUEUE_DRIVER=sync

database.php

<?php

return [
    'default' => 'neo4j',

    'connections' => [

            'neo4j' => [
                'driver' => 'neo4j',
                'host'   => env('DB_HOST', '127.0.0.1'),
                'port'   => env('DB_PORT', '7474'),
                'username' => env('DB_USERNAME', 'neo4j'),
                'password' => env('DB_PASSWORD', 'secret')
            ]
        ],
    ];

composer.json

{
    "name": "laravel/lumen",
    "description": "The Laravel Lumen Framework.",
    "keywords": ["framework", "laravel", "lumen"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=7.1.3",
        "laravel/lumen-framework": "5.6.*",
        "vlucas/phpdotenv": "~2.2",
        "vinelab/neoeloquent": "^1.4.6"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "phpunit/phpunit": "~7.0",
        "mockery/mockery": "~1.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/"
        ]
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ]
    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

app.php

<?php

require_once __DIR__.'/../vendor/autoload.php';

try {
    (new Dotenv\Dotenv(__DIR__.'/../'))->load();
} catch (Dotenv\Exception\InvalidPathException $e) {
    //
}

$app = new Laravel\Lumen\Application(
    realpath(__DIR__.'/../')
);

$app->configure('database');

// $app->withFacades();

// $app->withEloquent();

$app->singleton(
    Illuminate\Contracts\Debug\ExceptionHandler::class,
    App\Exceptions\Handler::class
);

$app->singleton(
    Illuminate\Contracts\Console\Kernel::class,
    App\Console\Kernel::class
);

// $app->middleware([
//    App\Http\Middleware\ExampleMiddleware::class
// ]);

// $app->routeMiddleware([
//     'auth' => App\Http\Middleware\Authenticate::class,
// ]);


// $app->register(App\Providers\AppServiceProvider::class);
// $app->register(App\Providers\AuthServiceProvider::class);
// $app->register(App\Providers\EventServiceProvider::class);
$app->register('Vinelab\NeoEloquent\NeoEloquentServiceProvider');


$app->router->group([
    'namespace' => 'App\Http\Controllers',
], function ($router) {
    require __DIR__.'/../routes/web.php';
});




return $app;

Thanks in advance


(Mau Moraca) #2

Fixed, the config folder that contain database.php it was locate in app folder but it should be locate in root folder.