Download the PHP package fsi/datagrid without Composer

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

FSi DataGrid Component

List component that displays the items from collection (data source) by using special column objects. Displaying objects list is one of the most common tasks in web applications and probably the easiest one, so you could ask how this component can help you?

FSi DataGrid Component allows you to create one action that handle display all kind of lists in your application without duplicating code. It can be very useful in all kind of admin panel generators.

Basic Usage

The sample code shows more than a thousand words so lets start!

Before you can display data you need to add columns into DataGrid component. Columns pull data from objects using DataMappers (They will be described later).

Imagine a situation where we need to display a list of news. List must contains such information as:

So we should get a table similar to the following:

Id News title Author Publication date Actions
1 First News Norbert Orzechowicz [email protected] 2012.05.01 15:13:52 Edit Delete
2 Second News Norbert Orzechowicz [email protected] 2012.05.06 15:13:52 Edit Delete

And here is our News object.

Suppose that we use Doctrine ORM and we can get a list of objects as follows:

So if we have data we need to build grid and pass data into it.

We assume that datagrid.factory is a service with DataGridFactory object instance. More about creating DataGridFactory and loading columns into it will be described later.

DataGrid::addColumn($name, $type = 'text', $options = array());

Ok, so now when we have grid its time to create view. This can be done by calling DataGrid::CreateView()

$view is DataGridView object that implements \SeekableIterator, \Countable and \ArrayAccess interfaces so have easy access to each row in view.

Every single row in view must be DataGridRowView object that also implements \SeekableIterator, \Countable and \ArrayAccess interfaces so you have access to each column in row.

And the last view part, column is an object with methods like getAttribute, getValue and few other that will help you to build perfect view.

Here is a simple view implementation:

Heads up! There is a difference between using getColumns method at view and direct array access.

Installation

This section will describe how to add datagrid into your project. First thing is to get DataGrid sources, we recommend you to use composer After that you need to do a couple of things to create DataGridFactory that finally allows you to create DataGrid objects.

Here are sample scenarios of component usage:

You can also add fsi/datagrid into composer.json and run composer.phar update or composer.phar install

Tests

Install PHPUnit To run tests for DataGrid you should install dev packages and run tests with commands:

Extensions

Extensions are something that makes DataGrid component extremely flexible, they are highly inspired by SymfonyForm extensions.

There are two kinds of extensions.

DataGrid Extension are used to provide new column types, event subscribers even additional options for existing column types.

DataGrid Column Extensions purpose is to add new functionality to existing column types.

Each DataGrid Column Extension must be loaded by DataGrid Extension. Loading extension into DataGrid is nothing more than registering it in DataGridFactory.

Built-in extension types

(You can find documentation for some of these extensions in doc/en/extensions folder.)

Built-in column types

(You can find documentation for types in doc/en/columns folder.)

Built-in available columns options

Action Action Symfony Boolean Collection Text
label label label label label
field_mapping field_mapping  field_mapping  field_mapping  field_mapping 
display_order display_order  value_glue  value_glue  value_glue 
actions  actions  display_order  display_order  trim
value_format value_format value_format
editable  collection_glue editable 
form_options form_options
form_type form_type
empty_value    empty_value 
true_value datetime_format
false_value input_type 
field_mapping_format
display_order 
Number DateTime Money Entity Tree
label label label label label
field_mapping  field_mapping  field_mapping  field_mapping  field_mapping 
value_glue  value_glue  value_glue  value_glue  value_glue 
display_order  display_order  display_order  display_order  display_order 
value_format value_format value_format value_format value_format
editable  editable  editable  editable  editable 
form_options form_options form_options form_options form_options
form_type form_type form_type empty_value empty_value
empty_value  empty_value  empty_value  relation_field em
value_glue_multiple  round_mode round_mode   glue_multiple
relation_field  precision  precision   
currency 
currency_field 
value_currency_separator 
thousands_sep
dec_point
decimals 

All versions of datagrid with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.0
symfony/event-dispatcher Version ^3.4|^4.0
symfony/property-access Version ^3.4|^4.0|^5.0
symfony/options-resolver Version ^3.4|^4.0|^5.0
fsi/reflection Version 0.9.*
fsi/data-indexer Version 0.9.*|^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 fsi/datagrid contains the following files

Loading the files please wait ....