Download the PHP package fluid22/modules without Composer

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

fluid22/modules

Small helpers for structuring WordPress plugins as modules: a shared League Container instance, an abstract Module base class (hooks + templates), and an optional Options model around get_option / update_option.

Package: fluid22/modules on Packagist
Source: github.com/fluid22/modules

Requirements

Installation

Autoloading loads Fluid22\Module\ from src/ and always includes src/helpers.php, which defines the global container() / start() API in the Fluid22\Module namespace.

Quick start

1. Bootstrap the container and modules

Early in your plugin (for example in the main plugin file after Composer’s autoloader):

start() registers each class with the container identified by the given key, resolves instances in order, and calls setup() on every instance that extends Fluid22\Module\Module.

Multiple plugins on one site: always pass a stable, plugin-specific key (your text domain works well) as the second argument to start() and container(). Each key gets its own isolated container, so bindings, the autowire setting, and resolved modules never collide across plugins. Omitting the key uses a shared 'default' bucket — fine for a single consumer, unsafe if other plugins might also use this library.

After all modules have booted, the library fires:

Use this to sequence cross-plugin wiring.

2. Define a module

Place each module in its own directory and extend Module. Implement setup() to register actions, filters, shortcodes, and so on.

The module’s directory is derived from the concrete class file path (get_dir()), so colocate templates/ next to that class.

3. Templates

Put PHP templates under {ModuleDirectory}/templates/, named {name}.html.php. Subfolders are allowed using / in the template name (for example emails/summary → templates/emails/summary.html.php).

Allowed name characters: letters, digits, _, -, and / between segments. The loader resolves paths with realpath() so files cannot escape templates/.

get_template() returns false if the name is invalid or the file is missing.

Variables are passed as an array; valid PHP variable names are extract()ed into the template with EXTR_SKIP, inside a narrow scope so they cannot clobber internal state. $this in the template is the module instance. Invalid array keys (numeric keys, bad identifiers) are ignored.

4. Dependency injection

container( string $key = null ) returns the League\Container\Container for that key, creating it on first access. By default, setup_container() delegates to League\Container\ReflectionContainer so constructors can type-hint dependencies when autowiring is enabled.

Disable autowiring (per-key via the filter’s second argument):

Register bindings before start() against the same key:

Containers are stored in $GLOBALS['fluid22_containers'] keyed by the container key. For back-compat, the default bucket is also mirrored to $GLOBALS['fluid22_container'].

Options model

Fluid22\Module\Models\Options is a thin, lazy wrapper over WordPress options with a required key prefix.

Packagist updates

This repository includes a GitHub Actions workflow that calls Packagist’s update-package API when you push to master/main or push tags. Configure PACKAGIST_USER and PACKAGIST_TOKEN in the repo’s Actions secrets, or use Packagist’s built-in GitHub integration instead.

License

MIT. See composer.json for author metadata.


All versions of modules with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
league/container Version ^4.2
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 fluid22/modules contains the following files

Loading the files please wait ...