Download the PHP package justenough/craft-siteawareconfig without Composer

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

Multi Site Config plugin for Craft CMS 3.x

What?

Set & retrieve Craft CMS config file values that are site-aware, with a clean API and easy defaults.

Why?

When working with multi-site Craft CMS installs, you may find yourself needing config values than should exist for all sites in an install, but vary in value between the sites themselves.

This plugin allows you to share your template code / partials across sites, while always getting the correct value for the current site (or for a different site, if required).

Example usecases:

Why use this instead of

How?

This plugin uses Craft's built-in ConfigHelper::localizedValue() helper to parse values in a config/siteaware.php config file and make them site aware. You can then consume them in your template / PHP code without having to worry about getting the right value for the right site.

See configuration below for config file syntax.

Requirements

This plugin requires PHP 7.4+ and Craft CMS 3.5 or later. It will probably work with older versions of Craft, but is untested with them.

Installation

Configuration

Edit the config file at config/siteaware.php to set your config values.

Retrieving config values

Templating

Config values for the current Site are exposed to Twig under craft.siteAwareConfig.currentSite:

If needed, you can access the config for any site by passing its handle to craft.siteAwareConfig.forSite()

PHP

An instance of justenough\siteawareconfig\services\Config is what gets exposed to Twig. Should you need to, you can also access site aware config settings from PHP-land:

The returned SiteAwareConfig extends Yii's BaseObject.

Caveats / Potential "Gotchas"

While values in multi-environment configs are merged, site-aware values using the array syntax are replaced. This is usually only an issue if you are using an associative array for your config value (for example to group related values together).

If you need to merge values between sites either flatten your values, or use a callable to handle the merging/default logic.

Attributions

Brought to you by Just Enough Consulting

Icon by Arthur Shlain via the NounProject.com


All versions of craft-siteawareconfig with dependencies

PHP Build Version
Package Version
No informations.
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 justenough/craft-siteawareconfig contains the following files

Loading the files please wait ....