Download the PHP package dmvdbrugge/dynamic-components without Composer

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

Dynamic Components

Dynamic Components for the PHP UI extension: use callbacks instead of hardcoded actions. Features advanced versions of the basic controls provided by the extension.

Build Status

Usage / Examples

The most basic example is a button that changes its text when clicked:

This in contrast to having to create a hardcoded or anonymous class:

When we take the first example a bit further, say we now want 3 buttons:

Whereas in the extends form you either need to duplicate the anonymous class multiple times (duplicating logic), or create an actual class (which gives you some additional options, but also more hassle).

Each callback will receive the component that the action triggers for as last parameter. Last mostly means only (and thus also first), but is relevant for Area's actions, as they receive multiple params already.

See also the examples, which feature several Controls used in different ways and coding styles. Every example is a fully working program and can be run directly with php, given of course the extension is enabled. See also csv2qif's FileSelect for a more advanced version of the filepicker. (Or any of its other UiComponents. It's kicked off in src/Command/Ui.php but that's the boring part.)

API

All components extend a class, usually the one provided by the extension. Inherited methods are unlisted but obviously still available. All component descriptions in this section are in the same format:

Clickable FQN (is link to its API docs)

Extra information, if any.

Controls

Button

UI\Controls\Button

Check

UI\Controls\Check

ColorButton

UI\Controls\ColorButton

Combo

UI\Controls\Combo

EditableCombo

UI\Controls\EditableCombo

Entry

UI\Controls\Entry

MultilineEntry

UI\Controls\MultilineEntry

Radio

UI\Controls\Radio

Slider

UI\Controls\Slider

Because UI\Controls\Slider accepts $min > $max and then flips them, so does DynamicComponents\Controls\Slider. However for clarity's sake you should pass them in the correct way, as the getters return the actual min and max.

Spin

UI\Controls\Spin

Because UI\Controls\Spin accepts $min > $max and then flips them, so does DynamicComponents\Controls\Spin. However for clarity's sake you should pass them in the correct way, as the getters return the actual min and max.

Advanced Controls

Combo

DynamicComponents\Controls\Combo

Radio

DynamicComponents\Controls\Radio

Other

Area

UI\Area

Executor

UI\Executor

Menu

UI\Menu

Menu has no actions itself, but is used for creating MenuItems. While DynamicComponents\MenuItems can be used with a UI\Menu, using a DynamicComponents\Menu has the following advantages: it adds itself as parent, it sets the MenuItem's name, and it has DynamicComponents\MenuItem as default in append(). It's fully backwards compatible though, so you can still create UI\MenuItems with it.

To facilitate both stricter typing and supporting PhpStorm's Advanced Metadata, add() has been added as correctly typed shortcut, together with addAs() which has arguments flipped compared to append() for type detection (which only works on the first param).

MenuItem

UI\MenuItem

Name and Parent are only available when created by a DynamicComponents\Menu. Theoretically, name could be set manually, but there is no guarantee that it's actually correct.

Window

UI\Window

The default action on a UI\Window without onClosing is to destroy() itself and call UI\quit(). To provide the same functionality in a flexible way DynamicComponents\Window does this as well, but you can prevent it by returning false from the callback.

Installation

Dynamic Components is just a single composer call away:

Background

csv2qif was a happy little commandline tool, until I stumbled upon the PHP UI extension (source). Coming from a web-background, where callbacks are flowing freely, the idea of hardcoding every button, dropdown, and radio was not a pleasant one. Thus the dynamic button was born, quickly followed by the advanced controls combo and radio.

Realizing this had nothing to do with the tool itself, the idea sparked to move them to a library of their own, providing a reason to let their actionable control-friends (check, entry, etc.) join the party. So here we are.

License

MIT License

Copyright (c) 2018-2019 Dave van der Brugge


All versions of dynamic-components with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.1
ext-ui Version *
webmozart/assert Version ^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 dmvdbrugge/dynamic-components contains the following files

Loading the files please wait ....