Download the PHP package starx/symfony-native-form-builder without Composer

On this page you can find all versions of the php package starx/symfony-native-form-builder. 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 symfony-native-form-builder

Symfony Native Form Builder Bundle

This bundle allows you to to create native forms on-the-fly right at your twig file without defining the form in controller/service.


Installation

Install from composer

composer require starx/symfony-native-form-builder

Enable the bundle

Enable your bunndle from your AppKernel.php

public function registerBundles() {
    $bundles = [
        ...,
        new Starx\SymfonyNativeFormBuilderBundle\StarxSymfonyNativeFormBuilderBundle()
    ];

    ...
    return $bundles;
}

Usages

In any twig file:

{%  
    set native_form = native_form_builder.getNativeFormView(
        path('your_route', {
            'id': user.id
        }),
        "GET"
) %}
{{ form_start(native_form) }}
    <input class="btn btn-sm" type="submit" value="Submit" />
{{ form_end(native_form) }}

This will create a native form without any previous declaration in controller/service.

Examples

  1. Quick delete form In any twig file:

    {%
        set native_delete_form = native_form_builder.getNativeFormView(
            path('your_route_delete_action', {
                'id': user.id
            }),
            "DELETE"
    ) %}
    {{ form_start(native_delete_form) }}
        <input class="btn btn-sm" type="submit" value="Delete"
           onClick="return confirm('Are you sure?')"
        />
    {{ form_end(native_delete_form) }}

    This will generate a quick delete form in your twig file with a single button and a CSRF token with DELETE http method, which is recommended way to delete a entity.

  2. Generating a quick form based on a predefined form type when you want to show list of entities with a small inline form on the side

    <table>
        <thead>
            ...
        </thead>
        <tbody>
            {% for entity in entities %}
                {%
                    set native_update_form = native_form_builder.getNativeFormView(
                        path('your_enity_edit_action', {
                            'id': user.id
                        }),
                        "POST",
                        'AppBundle\\Form\\EntityType',
                        entity
                    )
                %}
                <tr>
                    <td>
                        {{ entity.id }}
                    </td>
                    <td>
                        {{ entity.name }}
                    </td>
                    <td>
                        {{ form_start(native_update_form) }}
                            {{ form_widget(native_update_form.value_field) }}
                            <input class="btn btn-sm" type="submit" value="Update" />
                        {{ form_end(native_update_form) }}
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>

    This will generate quick update forms in your twig template file where you are showing list of entities showing only one field required to update.

Note:

I do understand that such use case in twig is discouraged, but other wise to solve such requirement you would have to

  • loop through the entities in controller
  • Manually create all the forms for each of those entities
  • Pass them in a view/twig variables to your twig template file and
  • Once again, loop through them again in twig file.

Instead of doing all this, as long as you don't over do it, simple use case as above should be justified.


All versions of symfony-native-form-builder with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.1
symfony/framework-bundle Version ~2.7|~3.0
symfony/process Version ~2.7|~3.0
symfony/yaml Version ~2.7|~3.0
twig/twig Version ~1.18
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 starx/symfony-native-form-builder contains the following files

Loading the files please wait ....