Download the PHP package firebrandhq/silverstripe-excel-export without Composer

On this page you can find all versions of the php package firebrandhq/silverstripe-excel-export. 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 silverstripe-excel-export

Silverstripe Excel Export module

This Silverstripe module makes it easy to export a set of Silverstripe DataObjects to:

This module is built by extending the standard SilverStripe DataFormatter.

Requirements

Suggestions

Installation

Install the module through composer:

Exporting your DataObjects

There's 3 ways you can export your data to a spread sheet.

Programmatically by calling the DataFormatter directly

3 DataFormatters are provided:

You can manually instantiate them to convert a list of DataObjects or a single DataObject.

convertDataObjectSet() and convertDataObject() will automatically set the Content-Type HTTP header to an appropriate Mime Type.

You can also retrieve the underlying PHPExcel object and export your DataObject set to whatever format supported by PHPExcel.

Add the GridFieldExcelExportButton to a GridField

The GridFieldExcelExportButton allows your CMS users to easily export the data from a GridField to a spreadsheet.

The above code snippet will display a split button allowing the user to export the GridField list to the format of their choice.

Unlike the SilverStripe GridFieldExportButton, the GridFieldExcelExportButton will export all the fields of the provided DataObjects ... not just the summary fields.

You can also use the GridFieldExcelExportAction component. This button is added to each row and allows you to export individual records one at a time. Out of the box, GridFieldExcelExportAction will export to xlsx, but you can get it to export to xls or csv (e.g.: new GridFieldExcelExportAction('csv')).

GridFieldExcelExportAction and GridFieldExcelExportButton can be used in conjunction if you want to give both options to your users.

Call via the SilverStripe RestfulServer Module

The SilverStripe RestfulServer Module allows you to turn any SilverStripe website into a RESTFul Server.

If you use the SilverStripe RestfulServer Module in conjunction with the Silverstripe Excel Export module, you'll be able to dynamically export any DataObject set just by entering the right URL in your browser.

Access control

Obviously, you don't want everyone to be able to download any data off your website. The SilverStripe RestfulServer Module will only return results for DataObject with the $api_access property set.

Additionally, access to individual DataObjects is controlled by the canView function.

Configuration the SilverStripe RestfulServer Module

Getting to the data

Exporting your data is just as easy as entering a URL.

SilverStripe RestfulServer Module Supported operations

Customising the output

There's 2 ways you can control the output:

Choose which fields to output

Because the ExcelDataFormatter extends DataFormatter, you can use methods like setCustomFields(), setCustomAddFields() or setRemoveFields() to control what fields will be present in the spread sheet.

Defining a default column set

You can customise the default column set that will be return for a specific DataObject class by defining a getExcelExportFields() method on your DataOject class.

This getExcelExportFields() method should return an array of fields following the same format used by DataObject::inheritedDatabaseFields():

You may also reference relationships in this array or dynamic properties:

This will also allow you to control the order the fields appear in the Spread Sheet. Note that ID will always be the first field and cannot be removed.

This behavior can be overriden for specific instances of ExcelDataFormatter by calling the setCustomFields() method.

Use field labels or field names as column headers

Out of the box, the actual field names will be used as column header. (e.g.: FirstName rather than First Name).

You can customise this behavior and use the Field Labels as define on your DataObject class instead. When generating the header row, ExcelDataFormatter will call the fieldLabel() method on your Data Object to decide what string to use in each header.

Change the default for all ExcelDataFormatter

In you YML config, you can use the following syntax to change the default headers.

Override the default for a specific instance

You may change the default behavior for a specific instance.


All versions of silverstripe-excel-export with dependencies

PHP Build Version
Package Version
Requires phpoffice/phpexcel Version >=1.8
silverstripe/cms Version >=3.1
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 firebrandhq/silverstripe-excel-export contains the following files

Loading the files please wait ....