Download the PHP package hello-motto/config-service-provider without Composer

On this page you can find all versions of the php package hello-motto/config-service-provider. 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 config-service-provider

ConfigServiceProvider for Silex 2

This is a Service Provider that permits to use YAML, JSON and PHP config files in a Silex app.

Requirements

Suggested

Installation

Install with Composer:

$ composer require hello-motto/config-service-provider dev-master

Or add to composer.json

Usage

This Provider will parse your YAML, JSON and PHP files to set config variables. Those config variables are available through $app['config']['myVariable']. Some special variables you can define (parameters variable) also are available through $app['parameters']. All the variables that are contained in the several config files are recursively merged in a array.

Add files

You can pass one or several files to the ServiceProvider in the 'config.files' argument. No matter if it's a json, yaml or php file

where PATH_TO_CONFIG_FILE is location of YML, JSON or PHP file with configuration for example

Files example :

config/config.php

config/config.json

config/config.yml

Add constants

You can also pass to the ServiceProvider constants parameters to replace in your config files. It permits to use the PHP functions within the configuration files. Constants name must begin and end with % character. You can set the constants in the 'config.constants' array :

config/config.json

config/config.yml

The app['config']['ourMotto'] variable will contain In tartiflette we trust.

Add closures

YAML and JSON files don't allow to use dynamic code. But some Providers like Security Provider are more powerful with closure parameters. That's why it's possible to add some closures with the 'config.closures' parameter. To use the closure parameter, your array must have the same tree structure.

Import files

It's possible to import files from a YAML or JSON config file. You just need to use the object "import" and set an array of resources. The files are always imported with a relative path from the current file. Notice that PHP config files don't support the import method.

config/config_dev.json

config/config_dev.yml

Traits

config() method

Adding this trait to your Application, you can use the config variables as object. $app['config'] will be available using $app->config(). You can also access to the first dimension of the array passing the parameter to the method. $app['config']['twig'] is available through $app->config('twig').

parameters() method

This shortcut also exists for the parameters variables. $app['parameters']['dbhost'] will be the same that $app->parameters('dbhost')

loadFile() method

This shortcut use the ConfigLoader to parse a JSON, YAML or PHP file into an array, replacing the constants that are already set.

loadManyFiles() method

This method does the same as loadFile() with an array of files as argument.

Licence

GPL 3.0

Message from the President

Beef...


All versions of config-service-provider with dependencies

PHP Build Version
Package Version
Requires silex/silex Version ^2.0
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 hello-motto/config-service-provider contains the following files

Loading the files please wait ....