Download the PHP package stellarwp/foundation-container without Composer
On this page you can find all versions of the php package stellarwp/foundation-container. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stellarwp/foundation-container
More information about stellarwp/foundation-container
Files in stellarwp/foundation-container
Package foundation-container
Short Description The Foundation DI container and its contracts.
License GPL-2.0-or-later
Informations about the package foundation-container
Foundation Container
[!WARNING] This is a read-only repository! For pull requests or issues, see stellarwp/foundation.
The DI Container configuration and Service Provider implementation, utilizing di52.
Installation
Container Configuration
Create a new ContainerAdapter, by passing in an instance of di52:
Here is an example Service Provider:
Environment Variable Configuration
This library uses the Dot package to set and fetch configuration
values, which are initially provided via Environment Variables, either manually set or via an .env file
utilizing vlucas/phpdotenv to read them.
Each Service Provider will have access to Dot via the $this->config property, it is best practice to only
access configuration variables from a Service Provider and never in your concrete classes.
Making a config.php
A sample config.php for a project. Note: we fall back to sane defaults if the environment variable isn't available.
Inside a Provider, we can then access deep variables with dot notation, e.g.
💡 If using a
config.phpin a WordPress plugin, simply add your configured $_ENV vars in your wp-config.php.
All versions of foundation-container with dependencies
adbario/php-dot-notation Version >=2.5
lucatume/di52 Version >=4.1
stellarwp/container-contract Version ^1.1
vlucas/phpdotenv Version >=4.3