Download the PHP package laruence/yaconf without Composer

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

Yaconf - Yet Another Configuration Container

AppVeyor Linux Windows

Ultra-fast, Secure, and Persistent Configuration Management for PHP

Requirement

Introduction

Yaconf is a configuration container. It parses INI files by default, with optional YAML support backed directly by libyaml, and stores the result in persistent memory at startup, where it stays for the entire PHP lifecycle.

Features

Ultra fast

Most PHP applications parse their configuration on every request. Yaconf does it once at startup and serves from memory forever: Yaconf::get() is a pure hash lookup — no file I/O, no parsing, no per-request allocation.

The parsed config lives in persistent, immutable zend_arrays, so PHP-FPM workers forked from the master share the same physical memory pages via the kernel's copy-on-write mechanism — memory is allocated once no matter how many workers run. Since 1.2.0 the whole tree is also compacted into a single contiguous block (strings deduplicated, hash tables re-laid out), cutting memory overhead and improving cache locality.

Yaconf stores static configuration — values read often but changed rarely, like credentials, feature flags, and routing tables — and resolves INI constants and environment variables once at parse time rather than on access. For runtime caching — query results, computed data, HTML fragments, ephemeral tokens — use Yac, which shares the same "local first, zero dependency" philosophy.

Secure

Yaconf reads the configuration directory once, at startup. Under PHP-FPM that read happens in the master process, which normally runs as root; workers drop to the pool user only after forking. Requests are then served entirely from memory, so a worker never reopens those files.

That ordering is what makes permission separation possible. Configuration can sit outside the web root, in a root-owned directory the pool user cannot read. Application code only ever calls Yaconf::get(), never the files themselves — so a file-disclosure or file-inclusion vulnerability cannot reach the credentials stored there.

The trade-off is hot reload. Reloading runs in the worker (RINIT), and a worker that cannot read the directory just keeps serving the configuration loaded at startup. Picking up a change means restarting or gracefully reloading PHP-FPM — a reload re-executes the master as root, so MINIT runs again and the new configuration is read.

If live reload matters more than the permission separation, make the directory readable by the pool user and tune yaconf.check_delay, the number of seconds between re-checks. Note that 0 means re-check on every request: it is the most eager setting, not a way to disable reloading. ZTS builds never reload.

Install

Install via PECL

Yaconf is a PECL extension, simply install it by:

Install via PIE (since 1.2.0)

Yaconf can also be installed with PIE, the PHP Installer for Extensions:

Compile from source

YAML support requires matching libyaml headers and libraries. On Windows, --with-yaml is enabled only when matching libyaml development inputs are available; otherwise the build warns and remains INI-only.

Runtime Configuration

INI Setting Default Description
yaconf.directory "" Path to the directory where supported configuration files are placed. .ini is always supported; .yaml and .yml require a build configured with --with-yaml. Sub-directories are loaded recursively (up to 16 levels deep).
yaconf.check_delay 300 Interval in seconds at which Yaconf checks for config file changes (by comparing directory mtimes — first the configured directory, then each tracked sub-directory). Set to 0 to check on every request. Only available in non-ZTS builds. In ZTS builds, configurations are still loaded at startup, but automatic reloading is disabled — restart PHP to pick up changes.

Constants

Yaconf always registers YACONF_HAVE_YAML, a boolean indicating whether YAML support was compiled into this build. Builds without --with-yaml set it to false and ignore .yaml and .yml files.

APIs

All Yaconf methods are static — you call them on the class directly, not on an instance.

Yaconf::get

Fetches a configuration value by its $name. The $name uses dot notation to traverse nested keys (e.g. "foo.name", "foo.features.1", "sub.x.role"). The maximum nesting depth is 64.

Returns the configuration value on success, or $default (which defaults to null) if the key is not found.

Yaconf::has

Returns true if a configuration value exists at $name, false otherwise.

C API for Other Extensions

Yaconf exports two functions via php_yaconf.h for use by other PHP extensions:

These mirror Yaconf::get() and Yaconf::has() in C. The header is installed by make install — include it in your extension with #include "ext/yaconf/php_yaconf.h".

Example

Directory

Assuming we place all configuration files in /tmp/yaconf/, add this to php.ini:

Supported Configuration Files

Yaconf always loads .ini files. Builds configured with --with-yaml also load .yaml and .yml. Files are loaded recursively from sub-directories (up to 16 levels deep). A sub-directory acts as a namespace: its name becomes a key level, and files (and further sub-directories) inside it nest below that key.

YAML files must have a mapping root. YAML mappings become PHP arrays; YAML lists retain numeric keys, so app.items.0 addresses the first item. YAML scalar types (string, int, finite float, bool, null) are preserved. YAML uses a static, native-parsed subset: exactly one document, no custom/timestamp/binary tags, aliases, shared nodes, complex keys, objects, resources, or references.

A supported file is keyed by its basename: app.ini, app.yaml, and app.yml all map to app. When same-directory enabled formats share a basename, Yaconf loads the first file found by its stable alphabetical scan and emits one warning while skipping later files; it does not hard-code an extension priority. A directory with that basename takes precedence over every supported file.

INI Files

Assuming there are two files in /tmp/yaconf:

foo.ini

bar.ini

The [children:base] syntax means: the children section inherits all keys from the base section, and can override any of them. Section inheritance can be chained (e.g. [grandchild:children] inheriting from a section that itself inherits from base), up to a maximum depth of 16.

YAML Files

YAML examples require a build configured with --with-yaml.

app.yaml

service.yml

The files above are available as app and service, so nested values are addressed with dot notation such as app.database.host, app.features.0, and service.service.endpoints.1.

Run

Let's retrieve the configurations from Yaconf:

foo.ini

You can also access configurations using dot notation:

bar.ini

Now let's see sections and section inheritance:

Sub-directories

Sub-directory support is available since 1.2.0.

Now assume /tmp/yaconf also contains sub-directories:

Each is addressed with the directory name as a prefix, at any depth:

Fetching a directory name alone returns the whole directory as an array:

phpinfo() Output

When yaconf.check_delay is non-zero, Yaconf adds a block to phpinfo() showing the directory being watched, the configured check delay, a list of all currently loaded supported configuration files (with their path relative to yaconf.directory) and their last modification time, plus a list of all tracked sub-directories.

License

PHP-3.01


All versions of yaconf with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 laruence/yaconf contains the following files

Loading the files please wait ...