Download the PHP package limenius/liform-bundle without Composer

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

LiformBundle

Bundle that integrates Liform into Symfony. Liform is a library to serialize Symfony Forms into JSON schema. For use with liform-react or json-editor, or any other form generator based on json-schema.

It is very annoying to maintain Symfony forms that match forms in a client technology, such as JavaScript. It is also annoying to maintain a documentation of such forms. And it's error prone, too.

LiformBundle generates a JSON schema representation, that serves as documentation and can be used to validate your data and, if you want, to generate forms using a generator.

Installation

First and foremost, note that you have a complete example with React, Webpack and Symfony Standard Edition at Limenius/symfony-react-sandbox ready for you, which includes an example implementation of this bundle.

Feel free to clone it, run it, experiment, and copy the pieces you need to your project. Because this bundle focuses mainly on the frontend side of things, you are expected to have a compatible frontend setup.

Step 1: Download the Bundle

Open a console, navigate to your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require limenius/liform-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:

Usage

Serializing a form into JSON Schema:

And $schema will contain a JSON Schema representation such as:

Information extracted to JSON-schema

The goal of Liform is to extract as much data as possible from the form in order to have a complete representation with validation and UI hints in the schema. The options currently supported are.

Check out the Liform documentation for more details.

Using your own transformers

Liform works by recursively inspecting the form, finding (resolving) the right transformer for every child and using that transformer to build the corresponding slice of the json-schema. So, if you want to modify the way a particular form type is transformed, you can add a transformer and configure it to to be applied for all children with a particular block_prefix.
To achieve this, you should create a new service definition and add the liform.transformer tag. You need to specify for which form-types your transformer will be applied by setting the form_type property of the tag to the corresponding block_prefix.

In the following example we are reusing the StringTransformer class. By specifying the widget property of the tag we can scope the transformer to only work for types with that particular widget.

You can of course use your very own Transformer class, just make sure to implement the required Limenius\Liform\Transformer\TransformerInterface when you do.

Extending the default behaviour

In addition to adding your own transformers for customizing the serialization of a specific form-type Liform allows you to add extensions to customize the default behaviour of all types.
In the following example we use an Extension to add a submit_url property to the schema representing the form's action parameter.

Make sure your Extension class implements the required Limenius\Liform\Transformer\ExtensionInterface. To register your extension; create a new service definition and add the liform.extension tag to it.

Serializing initial values

This bundle registers a normalizer to serialize a FormView class into an array of initial values that match your json-schema. The following example shows you how to use this feature in a controller action:

Serializing errors

This bundle registers a normalizer to serialize forms with errors into an array. This part was shamelessly taken from FOSRestBundle. Copy the following statements to use this feature:

The format of the array containing the normalized form errors is compatible with the liform-react package.

License

This bundle was released under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

LICENSE.md

Acknowledgements

The technique for transforming forms using resolvers and reducers is inspired on Symfony Console Form


All versions of liform-bundle with dependencies

PHP Build Version
Package Version
Requires limenius/liform Version ^0.19
symfony/dependency-injection Version ^5.4|^6.0
symfony/config Version ^5.4|^6.0
symfony/http-kernel Version ^5.4|^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 limenius/liform-bundle contains the following files

Loading the files please wait ....