Download the PHP package wpfulcrum/config without Composer

On this page you can find all versions of the php package wpfulcrum/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 config

Config Module

Build Status Latest Stable Version License

The Fulcrum Config Module provides a runtime configuration component for your WordPress project. It's minimal and lean.

Using dependency injection via the ConfigContract, a PHP interface, you are able to inject a specific implementation's configuration for each object. Forget about hard-coding parameters, as these require you to change them for each implementation or project. Instead, abstract them into a configuration array and then load that file into Config, making your code more readable, reusable, testable, and maintainable.

Features

This module provides a clean, reusable method of:

  1. Abstracting all of your specific implementation's configuration parameters, organizing them in one file.
  2. Converting the implementation's array into a Config object.
  3. When you want a common set of defaults (such as for shortcodes, post types, taxonomies, widgets, and more), pass in the defaults. Bam, the module handles deeply merging those defaults with each of the implementations.
  4. You can get one or more of the parameters when you need them using:
    • standard object notation, such as $this->config->numOfPosts
    • using the get() method with single or "dot" notation.
  5. Pushing additional parameters into a single configuration.
  6. and more.

Installation

The best way to use this component is through Composer:

"Dot" Notation

Like all of the Fulcrum modules, we borrow from Laravel's "dot" notation to access deeply nested array elements. What is "dot" notation? Great question.

Dot notation is a clever mechanism to access deeply nested arrays using a string of the keys separated by dots.

Here let me show you. Let's say you have a deeply nested array like this one:

To get at shortcode's default open icon, you would do $config->get('default.open_icon). Notice you using "dot" notation you are able to drill down into the array and select the open icon's value.

How? It uses the Fulcrum Extender's DotArray module. Seriously, the Array Module is an awesome PHP extender, making your life much easier when working with deeply nested array.

Common Basic Usage and Functionality

Creating a Configuration File

Typically, you will create a PHP file that is stored in a config/ folder within our theme or plugin. In that file, you'll build and then return an array of all the specific implementation's configuration parameters.

Let's use the configuration example from above, which is for a QA shortcode:

Creating a Configurable Object

Using the above configuration file, here's how you might inject it into a Shortcode class:

Notice how we define our dependency injection via the ConfigContract interface, thereby allowing you to swap out the implementation to a different Config repository.

Also notice how we loaded the view file in the render() method: include $this->config->view; The parameters you passed in are available to you as an object property or via using the $this->config->get('view') method.

Creating the Config and Injecting It

To create an instance of your configuration parameters, it's best to use the ConfigFactory. You can pass it:

  1. The configuration parameters via the path to the configuration file or an array.
  2. The default parameters via the path to the default's file or an array.

Here, let me show you some examples using our QA shortcode code above.

Example - Via the path to the configuration file

Example - Including common defaults

Working With a Configuration

There are several methods available for you to work with the configuration within your objects.

Contributing

All feedback, bug reports, and pull requests are welcome.

Credits

The "dot" notation and much of the basic structure of the Config class is a customized implementation of the Illuminate Config component from Laravel.


All versions of config with dependencies

PHP Build Version
Package Version
Requires php Version ^5.6|^7
wpfulcrum/extender Version ^3
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 wpfulcrum/config contains the following files

Loading the files please wait ....