Download the PHP package wpbones/flags without Composer
On this page you can find all versions of the php package wpbones/flags. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download wpbones/flags
More information about wpbones/flags
Files in wpbones/flags
Package flags
Short Description Flags for WP Bones
License MIT
Homepage https://github.com/wpbones/flags
Informations about the package flags
Flags for WP Bones
Flags for WP Bones is a PHP package designed for the WP Bones framework, allowing you to enable or disable features in plugins using YAML configuration files. This approach simplifies feature management and makes the plugin more flexible and easy to configure, even for non-technical users.
Key features
- Enable and Disable Features: Using flags, you can easily activate or deactivate specific plugin features.
- YAML Configuration: YAML files are easy to read and modify, and can be used to configure various plugin options.
- Flexibility: The path and name of the YAML file can be customized through the plugin configuration.
- Reusability: The same YAML file can be used across different plugins, improving code consistency and maintenance.
Installation
You can install third party packages by using:
I advise to use this command instead of composer require
because doing this an automatic renaming will done.
You can use composer to install this package:
You may also to add "wpbones/flags": "~0.7"
in the composer.json
file of your plugin:
and run
YAML file example
You can find more information about the YAML syntax in the Symfony documentation.
YAML file configuration path
You can creare your own YAML file everywhere in your plugin, but I suggest to create it in the config
directory of your plugin.
The default path and filename is:
Set the flags path in the plugin configuration
You can set the path and filename in the plugin configuration by adding the following line in the config/plugin.php
file of your plugin:
Basic usage
You can use the wpbones_flags
helper function to get the value of a flag:
The first parameter is the flag name, and the second parameter is the default value if the flag is not found.
You may also use the class directly:
or by using the static method:
Set the flags path by method
You may also set/change the path by using:
or the fluent method withPath
:
by using the class directly:
or by using the static method: