Download the PHP package notus.sh/wp-static-options without Composer

On this page you can find all versions of the php package notus.sh/wp-static-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 wp-static-options

wp-static-options

A WordPress plugin for developers to force strategic WordPress options through configuration files.

Why wp-static-options?

WordPress is well-known to be customizable through dozens of options and most plugins try to offer the same level of configurability. All options can be edited through WordPress Administration in a more or less organized and comprehensive way, depending on how many plugins you have, how complex they are and how thorough were plugin developers to follow WordPress administration's guidelines.

It's great and it's a pain. Great because it allows people who know nothing about web technologies to publish their website (sometimes after some headaches). A pain because, as a project grows, you'll certainly end with some options that must definitely not be changed unless you want its public part to fall apart (or, at least, behave in unexpected ways).

Need examples? Just think about WordPress permalinks or WooCommerce payment gateways options and I think you'll get the point.

What does wp-static-options?

wp-static-options allows you to set options once and for all in configuration files. It hooks into WordPress's get_option to always return the right value (the one you want to be set).

Installation

Using Composer

wp-static-options works better when combined with roots/bedrock or a similar Composer setup for WordPress with composer/installers :

Once your setup is correct, install this package via Composer:

From sources

Grab the latest tarball from this repository releases' page and extract it to your WordPress Must-Use plugins folder (defaults to wp-content/mu-plugins).

Usage

Define your configuration directory

wp-static-options expect a STATIC_OPTIONS_DIR constant to be defined and contain the path to your configuration directory as a string. You can define it in your wp-config.php (or config/application.php if you use Root's Bedrock).

If you don't define your own, a default value for STATIC_OPTIONS_DIR will be set to WP_CONTENT_DIR . '/config/'.

Write your configuration files

wp-static-options will recursively load configuration files from STATIC_OPTIONS_DIR and merge them. Any file format supported by hassankhan/config is accepted. Feel free to split your configuration in as many files as you need (ex: one per plugin) and organise them the way you like.

For scalar options (whose values are integers, strings or numerically indexed arrays), add a top-level key to your configuration file and set the value:

Some plugins store their options as serialized arrays. You can set only values you really need to and let WordPress manage the others:

Caveats

Du to the way WordPress handle the return of pre_option_* filters, false booleans are not valid configuration values.

Contributing

Development environment

You can use dev/docker/Dockerfile to build a lightweight local development environment with PHP 7.4 and Composer.

Then run the container with :

Available Composer scripts

Please use the available Composer scripts to validate your changes.


All versions of wp-static-options with dependencies

PHP Build Version
Package Version
Requires hassankhan/config Version ^2.2.0
webmozart/glob Version ^4.1.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 notus.sh/wp-static-options contains the following files

Loading the files please wait ....