Download the PHP package fiedsch/contao-jsonwidget without Composer

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

JSON and YAML Widgets for Contao

The jsonWidget can be used in DCA files to create a text field that contains a JSON string. While saving it will be checked if that the string is valid JSON. The widget displays the JSON string with JSON_PRETTY_PRINT so that checking/finding errors is easier for the user.

The yamlWidget is mostly the same, except that it uses the YAML format.

Example: extending Members

DCA

Other valid options in eval are the same as for textareas (as WidgetJSON extends TextArea), except that setting rte will be ignored because the editors provided do not make sense here.

How to use the JSON data?

Extend tl_member as in the above example. Then create an ExtendedMemberModel that extends Contao's MemberModel. In the magic methodd __set() and _get you can intercept the "fields" stored in json_data. The Fiedsch\JsonWidgetBundle\JsonGetterSetterTrait takes care of that:

Using the Model

YAML-Syntax Highlighting with ACE

Set

in your field's DCA definitions.

Quick and dirty way: add desired CSS-Rules like e.g.

to your be_ace.html5 (which you create it if you do not yet have a custom version). OR: use a custom backend style and add the CSS rules there.

Set JSON (or JAML) Data

If you want to set all the JSON (or YAML) data at once you cannot use

To do this you have to use

Note that this way previously set JSON (or YAML) data is overwritten.

Also note that the behaviour of setJsonColumnData([]) (when setting an empty data array) changed in version 0.5.0. Previously it created [] where it now creates {} in the respective database column.

In version 0.7.0 we slightly changed this again to achieve the original goal: The storage of empty arrays as object ({}) is only enforced on the top level of the data. In lower levels, empty arrays will be stored as arrays ([]) not as "empty" objects ({}): compare { "foo": [] } (versions >= 0.7.0) to { "foo": {} } (versions >=0.5.0 and <0.7.0).


All versions of contao-jsonwidget with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
contao/core-bundle Version ^4.9 || ^5.1
symfony/yaml Version ^4.2 || ^5.0 || ^6.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 fiedsch/contao-jsonwidget contains the following files

Loading the files please wait ....