Download the PHP package alcamo/conf without Composer

On this page you can find all versions of the php package alcamo/conf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package conf

Usage examples

use alcamo\conf\{Loader, XdgFileFinder}

$conf = (new Loader(new XdgFileFinder('foo')))->Load(
    [ 'default.ini', 'conf.ini' ]
);

Now $conf contains an array representing the contents of $XDG_CONFIG_HOME/foo/default.ini and $XDG_CONFIG_HOME/foo/conf.ini, where items in the latter replace items in the former with the same key, if $XDG_CONFIG_HOME is set. Otherwise, foo/conf.ini is searched as specified in the XDG Base Directory Specification

use alcamo\conf\{Loader as LoaderBase, XdgFileFinder as XdgFileFinderBase}

class XdgFileFinder extends XdgFileFinderBase
{
    public const SUBDIR = 'foo';
}

class Loader extends LoaderBase
{
    public const DEFAULT_FILE_PARSER_CLASS = XdgFileFinder::class;

    public const CONF_FILES = [ 'default.ini' ];
}

$conf = (new Loader())->Load('conf.ini');

This has exactly the same effect and may be more useful if configurations are loaded from the same subdirectory in many places in the code, in particular when there is a common basic configuration files plus specific configuration files.

use alcamo\conf\{Loader as LoaderBase, XdgFileFinder as XdgFileFinderBase}

class XdgFileFinder extends XdgFileFinderBase
{
    public const SUBDIR = 'bar';
}

$cacheFilename = (new XdgFileFinder(null, 'CACHE'))->find('data.json');

Now, $cacheFilename contains $XDG_CACHE_HOME/bar/data.json if $XDG_CACHE_HOME is set. Otherwise, the path is constructed as specified in the XDG Base Directory Specification. If the directory $XDG_CACHE_HOME/bar did not exist, it has been created automatically.

Supplied interfaces, classes and traits

Interface FileFinderInterface

Interface for configuration file finders to put into a Loader object.

Class XdgFileFinder

Finds config files and other files following the XDG Base Directory Specification.

Interface FileParserInterface

Interface for file parsers to put into a Loader object.

Class IniFileParser

Parser for INI files.

Class JsonFileParser

Parser for JSON files.

Class FileParser

Parser for INI or JSON files, telling the file type from the suffix.

Interface LoaderInterface

Interface implemented by the Loader class.

Class Loader

Contains a file finder and a file parser object and uses them to locate and load file or a nuimber of files.

Interface HavingConfInterface

Class that provides an array with configuration data.

Trait HavingConfTrait

Simple implementation of HavingConfInterface.


All versions of conf with dependencies

PHP Build Version
Package Version
Requires php Version 7.3 - 8.5
alcamo/exception Version ^0.1
dnoegel/php-xdg-base-dir Version ^0.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package alcamo/conf contains the following files

Loading the files please wait ...