meanbee/libmageconf

This package is abandoned and no longer maintained. No replacement package was suggested.

Discover Magento environment and configuration information outside of an application installation.

1.0.0 2016-09-15 18:08 UTC

This package is not auto-updated.

Last update: 2023-08-05 13:17:30 UTC


README

Build Status Scrutinizer Code Quality Code Coverage

This library provides a mechanism for discovering a Magento (1.x and 2.x supported) installation, given a starting directory. This is useful for building tools that integrate externally with Magento but still need access to its configuration or certain files, such as magedbm and mageconfigsync.

Installation

composer require meanbee/libmageconf

Usage

Given that I have Magento installed in /home/nrj/magento, I can discover its location with the following code:

$rootDiscovery = new RootDiscovery('/home/nrj');

// Outputs: "Root: /home/nrj/magento"
printf("Root: %s", $rootDiscovery->getRootDirectory());

Given that I know where the Magento installation's local.xml is, I can access the configuration held in that file with the following code:

$configReader = ConfigReader\MagentoOne("path/to/local.xml");
$databaseName = $configReader->getDatabaseName();

or

$configReader = ConfigReader\MagentoTwo("path/to/env.php");
$databaseName = $configReader->getDatabaseName();