Download the PHP package mazentouati/simple-2way-config without Composer

On this page you can find all versions of the php package mazentouati/simple-2way-config. 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 simple-2way-config

mazentouati/simple-2way-config

GitHub (pre-)release Build Status Scrutinizer Code Quality Codecov branch StyleCI Maintainability

Simple 2 way configuration is a php-based read and write configuration library. It's suitable for applications that require the use of file system to store preferences or configuration.

Installation

we recommend installing this package through composer :

Usage

The simplest way to use it is through the package's factory. The factory's required parameter is the path of the directory that holds your config files.

Now you can access to a config value using dot notation '{filename}.path.to.value'

Note: your config file should be an array-based configuration, check this example

API

the config API implements the S2WConfigInterface.

the examples shown below will assume that you already assigned your config to a variable called $config

get(string $path, mixed $default = null)

Get a value using dot-notation path using this convention {filename}.path.to.value

optionally you can pass a default value to return when it find nothing, by default it returns null

set(string $path, mixed $value)

Update a value in the runtime configuration.

Note: if it's unable to find the config's filename it will create a new key for that filename in the runtime instance. The same for values, if there's any missing part in the dot path it will automatically create it in the runtime instance.

sync(mixed $specificConfiguration = false)

Syncs the runtime configuration with the source file

by default it will sync all files, though you can pass a specific file to sync

using sync will create a backup file to stay safe if something wrong happen. the backup will create alongside the original file holding this name {original_file_name}.backup.php. if the backup fails due to a lack of permission ( it uses PHP copy function) it will throw an exception S2WConfigException. To avoid any ugly expections errors you can use sync this way

in case of expection this code will print something like

Configuration sync is unable to save a backup for { path_to_directory\database.php }, please check your permissions

Note: this method will sync any news values or updated values you made using the set method. Even if you set inexistent config file into the runtime configuration, using set, this method will create that file for you. Use it with caution if you don't want any unwanted behavior

Configuration File Formats

The configuration file must be a valid php file and return a valid array.

Contributing

Please check the guide

LICENSE

© MIT | 2018, mazentouati/simple-2way-config


All versions of simple-2way-config with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.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 mazentouati/simple-2way-config contains the following files

Loading the files please wait ....