PHPackages                             wpbones/flags - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wpbones/flags

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wpbones/flags
=============

Flags for WP Bones

1.0.4(1y ago)064MITPHPPHP &gt;=7.4

Since Sep 19Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/wpbones/flags)[ Packagist](https://packagist.org/packages/wpbones/flags)[ Docs](https://github.com/wpbones/flags)[ RSS](/packages/wpbones-flags/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

Flags for WP Bones
==================

[](#flags-for-wp-bones)

[![Latest Stable Version](https://camo.githubusercontent.com/da07d6d56dea1db59f11df911aa02edd2dbde1440d5fdb52b7eda3fd55bcecb1/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f666c6167732f762f737461626c653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/flags) [![Latest Unstable Version](https://camo.githubusercontent.com/0a5ca5ee7e24a1f045dbbcf76bdaee1af89a87e3673f52b51ac62200ffc519af/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f666c6167732f762f756e737461626c653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/flags) [![Total Downloads](https://camo.githubusercontent.com/b1ee35769de0f8d773358193e8beccc923c61483cd2b8a13d5bde70ed67335ba/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f666c6167732f646f776e6c6f6164733f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/flags) [![License](https://camo.githubusercontent.com/8066e109a9023ba85ee81d37b51f4767ed036540e7c20156ade875c65283accf/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f666c6167732f6c6963656e73653f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/flags) [![Monthly Downloads](https://camo.githubusercontent.com/9981c8c4af91479d99fac2811e9cf0ad76d66a11b3bf8a37590a7abba5bbcfff/68747470733a2f2f706f7365722e707567782e6f72672f7770626f6e65732f666c6167732f642f6d6f6e74686c793f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/wpbones/flags)

Flags for [WP Bones](https://wpbones.com) is a PHP package designed for the WP Bones framework, allowing you to enable or disable features in plugins using [YAML](https://yaml.org/) configuration files. This approach simplifies feature management and makes the plugin more flexible and easy to configure, even for non-technical users.

Key features
------------

[](#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
------------

[](#installation)

You can install third party packages by using:

```
php bones require wpbones/flags
```

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:

```
composer require wpbones/flags
```

You may also to add `"wpbones/flags": "~0.7"` in the `composer.json` file of your plugin:

```
  "require": {
    "php": ">=7.4.0",
    "wpbones/wpbones": "~1.5",
    "wpbones/flags": "~1.1"
  },
```

and run

```
composer install
```

YAML file example
-----------------

[](#yaml-file-example)

```
# The version of the file is 1.0.0
version: "1.0.0"
example:
  # Enable or disable the Example feature
  enabled: true
  # Throttle request time in minutes
  # By setting this value to 0, the feature will be disabled
  throttle: 5
  # Request timeout
  timeout: 0
```

You can find more information about the YAML syntax in the [Symfony documentation](https://symfony.com/doc/current/components/yaml.html).

YAML file configuration path
----------------------------

[](#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:

```
config/flags.yaml
```

### Set the flags path in the plugin configuration

[](#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:

```
