Download the PHP package futuretek/yii2-options without Composer

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

Yii2 Options

This extension provide application configuration support stored in database.

WARNING: Version 2.x introduces breaking changes. Upgrading from version 1.x is possible but requires additional actions.

Steps to migrate to version 2.x:

Installation

The preferred way to install this extension is through composer.

Either run

or add

to the require section of your composer.json file.

Configuration

To start using this extension you have to load it in Yii config:

The component itself can be configured with the following properties:

Property Default value Description
db db The DB connection object or the application component ID of the DB connection.
cache cache The cache object or the application component ID of the cache object. The option data will be cached using this cache object.
optionTable {{%option}} The name of the option table.
cachingDuration 0 The time in seconds that the options can remain valid in cache. Use 0 to indicate that the cached data will never expire.
enableCaching false Whether to enable options caching
configFile Options config file. This file will be required. File must return config array.
config Variable into which the config from configFile will be loaded.

Notice: Option config is lazy-loaded on init (as opposite of including it in the application config). This is because the translation engine is not available at that time.

Option config/definition array contains list of the option groups.

Option group

Every option group consists of these attributes. Attributes marked with (*) are required.

Option items

Option group attribute items is array containing option items.

Option item consists of these attributes. Attributes marked with (*) are required.

ADVICE: If you need to create divider between options in the same option group, simply put string as one of the items array item.

Config example

Usage

This extension creates options component for storing configuration.

Getting options

Setting options

Context options

Context comes handy in case you need to deal with storing different configuration for multiple entities (for example user configuration).

In this use case context can be uses. Simply specify entity identificator as context and entity record id as context_id and you are done.

Getting and setting options is done via another arguments of methods get() and set().

Rendering settings page

If you want to render settings page, there is futuretek\options\IndesAction provided. You can simply add it to the controller actions() method.

There is also futuretek\options\OptionsHelper that provides method for rendering option edit field based on option type.

See mentioned files for more details.

Development

Translations

Translations are managed trough standard Yii2 translations. To automatically register extension translations we recommend to use our another extension futuretek/yii2-composer.

To generate messages for translating run the following command in extension root directory.

Assets

Assets are managed by Compass


All versions of yii2-options with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
yiisoft/yii2 Version ^2.0.0
yiisoft/yii2-bootstrap Version ^2.0.0
futuretek/yii2-migrations Version ^1.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 futuretek/yii2-options contains the following files

Loading the files please wait ....