Download the PHP package 20steps/autotables-bundle without Composer

On this page you can find all versions of the php package 20steps/autotables-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 autotables-bundle

20steps/autotables-bundle (twentystepsAutoTablesBundle)

Dependency Status Packagist version

About

The 20steps AutoTables Bundle provides an easy way for displaying entities in Symfony2 applications in auto-generated and editable tables. The tables are rendered by DataTables and are made editable with a patched version of jquery.datatables.editable.

The AutoTables Bundle is licensed under the LGPL license version 3.0 (http://www.gnu.org/licenses/lgpl-3.0.html).

Features

Installation

Require the bundle by adding the following entry to the respective section of your composer.json:

Get the bundle via packagist from GitHub by calling:

Register the bundle in your application by adding the following line to the registerBundles() method of your AppKernel.php:

Add the bundle to your assetic configuration in config.yml:

Add the bundle's routes to your routing.yml

Usage

The following sections describe how to integrate the auto-generated tables in your application. As a prerequisite the steps of the Installation section has to be done.

Global configuration

The bundle is configured in your config.yml with a section named twentysteps_auto_tables:

Possible global configuration options are:

Table specific configuration

Now the tables to be rendered by the bundle has to be configured. This happens as a list in a tables section. Each table configuration has to have an id property. This is used to reference the configurations in later calls to the bundle.

repository and service

Additionally each table configuration has to define either a repository or a service. The repository is the name of a Doctrine repository for handling the entities to be printed. If you are not using Doctrine (or for some other reason) you can define a service pointing to a service implementing the AutoTablesCrudService interface.

trans_scope

With the property trans_scope you can define a new scope for translating the messages used for the table. These are the names of the columns and some additional messages like found in the messages.en.yml file of the bundle. By default the value from the global configuration is used.

datatable_options

The property datatables_options may be used to give some table specific DataTables plugin configuration, which will extend any configuration in the global section.

views

The views option may point to a directory with custom templates for overwriting the ones of the bundle.

columns

With columns you are able to overwrite any setting done by an autotables annotation resp. you are able to define settings that hasn't been configured by an annotation. Any column setting in the config.yml overwrites any annotation.

Currently the following things may be configured for a column: name, readOnly, type, order and ignore.

The parameter selector has to be given to select the column to be overwritten. This may be a property like description, or a method like getDisplayName().

For columns that should be auto initialized while using the add entry form, you may configure an initializer section. This section may contain the values repository, value and id.

The property value simply selects a constant value to be injected into each new entity with this column. By selecting a repository one is able to inject an object found by a given id. The id may be passed by a constant value here in the config.xml or later in the Twig view while using the function ts_auto_table_options.

Example

Here is an example of a configuration given for a table products:

Annotation of entities

The information needed to render any column into a table is taken from annotations found in the entity. The bundle searches for Doctrine annotations like @Doctrine\ORM\Mapping\Column and @Doctrine\ORM\Mapping\Id. If you want to give a different name, set an order value or for some other reason you can use the bundle's annotation twentysteps\Bundle\AutoTablesBundle\Annotations\Column. Even getter methods may be annotated with this annotation, to create a column displaying the value returned by the getter. To be able to update the value in this case, a setter of the same name has to be created (getFoo/setFoo). It's even possible to disable the editing of a column by using the readOnly property of the annotation.

If you want to avoid rendering the column in the auto generated table, you should set the ignore flag of the annotation to true. In this case the property resp. method is ignored by the bundle.

Like mentioned in the configuration section, any column may be initialized automatically while using the add entry form. This may be configured with the Initializer annotation like described in the configuration section or shown in the following examples:

The following code block shows a complete example of a properly annotated entity for AutoTablesBundle:

View integration

Now your view has to be modified to render the table for your entities. We are assuming here that you are using Twig templates.

ts_auto_table_stylesheets

The needed stylesheets of the bundle are included with the Twig function ts_auto_table_stylesheets. The stylesheets of the selected frontend framework may be included here, if the corresponding option is set to true: includeJqueryUi resp. includeBootstrap3.

ts_auto_table_options

You have to define at least the entities and the tableId for the data to be rendered. This is done by the function ts_auto_table_options like done in the following example:

As you can see you can also overwrite the configuration of any column here.

ts_auto_table_html

The HTML for the table has to be rendered with the Twig function ts_auto_table_html. To be able to render any table here, you have to ensure that the function ts_auto_table_options is called in advance.

ts_auto_table_js

Finally the javascript code for the table has to be rendered. This is done by the Twig function ts_auto_table_js. By default all needed javascript libraries are loaded excepting the jquery library. This behaviour can be configured by the following options: includeBootstrap3, includeJquery, includeJqueryUi, includeJqueryEditable, includeJqueryDataTables and includeJqueryValidate

The DataTables configuration may be extended here with the option dtOptions.

Furthermore the transScope may be overwritten here and the routes for the CRUD controller actions with the options updateRoute, deleteRoute and addRoute.

The option reloadAfterAdd (default true) may be set to true to reload the page after an entity has been added. Currently this is needed to refresh any links rendered in custom view templates.

There is also an option reloadAfterUpdate (default false), with the same effect.

And like ts_auto_table_html this function also needs to be preceded by a call to ts_auto_table_options.

Example

In the following example you can see how to build a view displaying the entity products:

Author

Sponsored by

20steps - Digital Full Service Boutique


All versions of autotables-bundle with dependencies

PHP Build Version
Package Version
Requires symfony/framework-bundle Version ^2.3|^3.0
brandonwamboldt/utilphp Version ^1.0
danielstjules/stringy Version ^2.0
20steps/commons-ensure-bundle 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 20steps/autotables-bundle contains the following files

Loading the files please wait ....