Skip to content

Commit

Permalink
Add config/container.php
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksei Khudiakov <aleksey@xerkus.pro>
  • Loading branch information
Xerkus committed Mar 9, 2023
1 parent e8433e7 commit 1a242e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
13 changes: 13 additions & 0 deletions config/container.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

use Laminas\Mvc\Application;
use Laminas\Stdlib\ArrayUtils;

// Retrieve configuration
$appConfig = require __DIR__ . '/application.config.php';
if (file_exists(__DIR__ . '/development.config.php')) {
$appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/development.config.php');
}

return Application::init($appConfig)
->getServiceManager();
11 changes: 3 additions & 8 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare(strict_types=1);

use Laminas\Mvc\Application;
use Laminas\Stdlib\ArrayUtils;

/**
* This makes our life easier when dealing with paths. Everything is relative
Expand Down Expand Up @@ -32,11 +31,7 @@
);
}

// Retrieve configuration
$appConfig = require __DIR__ . '/../config/application.config.php';
if (file_exists(__DIR__ . '/../config/development.config.php')) {
$appConfig = ArrayUtils::merge($appConfig, require __DIR__ . '/../config/development.config.php');
}

$container = require __DIR__ . '/../config/container.php';
// Run the application!
Application::init($appConfig)->run();
$container->get('Application')
->run();

0 comments on commit 1a242e4

Please sign in to comment.