Download the PHP package wordpressvn/wp-settings without Composer

On this page you can find all versions of the php package wordpressvn/wp-settings. 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 wp-settings

WP Settings

This package aims to make it easier to create settings pages for WordPress plugins. Typically, you would use the Settings API or write something custom. While the Settings API works, there is still quite a lot to set up. You still need to write the HTML for your options for example. And it gets quite complicated if you want to add tabs and tab-sections. See this comparison.

Installation

Usage

Basic example

Creating the settings instance

By default, the page slug is created by sanitizing the title. You may pass a specific slug as the second parameter of the constructor.

Other methods for this class:

Tabs

Tabs are only displayed when there is more then one.

Sections

You can call the add_section method from an instance of Tab. You can also call it from the WPSettings instance. It will then be added to the last created Tab.

If you want sections to be displayed as submenu-items, you can do:

Note that this only has an effect when you have more then one as_link section.

Options

To add an option, you either call the add_option method from an instance of Section. You may also call add_option from the WPSettings instance. The option will then be added to the last created section.

Text

In addition to name and label, you can also pass type. This makes it possible to set the input type to, for example, password or number.

Textarea

You may also set the cols and rows attributes.

Checkbox

Select

Select2

WP Editor

Code Editor

Color

Media

For an image specific, you can use:

For video specific, you can use:

Validation

You are able to validate an option. You may pass a callback and a feedback message. You can pass multiple validation rules.

Sanitization

You may pass a sanitization callback.

Options array structure

By default, the options are stored as a one level array:

However, you can add tab and/or section levels in this structure.

Which would result in:

Adding a custom option type

To add an custom option type, you can use the wp_settings_option_type_map filter.

You will need to create a class for your custom option type.

Once registered, you can then use your option type like so:

Contributors

License

MIT. Please see the License File for more information.


All versions of wp-settings with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
adbario/php-dot-notation Version ^3.3
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 wordpressvn/wp-settings contains the following files

Loading the files please wait ....