Download the PHP package pxlrbt/filament-excel without Composer

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

![header](./.github/resources/pxlrbt-excel.png)

Filament Excel

[![Latest Version on Packagist](https://img.shields.io/packagist/v/pxlrbt/filament-excel.svg?include_prereleases)](https://packagist.org/packages/pxlrbt/filament-excel) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md) ![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/pxlrbt/filament-excel/code-style.yml?branch=main&label=Code%20style&style=flat-square) [![Total Downloads](https://img.shields.io/packagist/dt/pxlrbt/filament-excel.svg)](https://packagist.org/packages/pxlrbt/filament-excel)

Easily configure your Excel exports in Filament via a bulk or page action.

[Demo Video](https://user-images.githubusercontent.com/22632550/174591523-831df501-76d5-456a-b12e-f6d8316fb673.mp4 ':include :type=video controls width=100%')

Installation

Install via Composer. This will download the package and Laravel Excel.

Plugin Version Filament Version PHP Version
1.x 2.x > 8.0
2.x 3.x > 8.1

Laravel > 9

If composer require fails on Laravel 9 or greater because of the simple-cache dependency, you will have to specify the psr/simple-cache version as ^2.0 in your composer.json to satisfy the PhpSpreadsheet dependency. You can install both at the same time as:

Quickstart

Starting with v0.2 Filament Excel should work with both filament/filament and filament/tables packages. The most simple usage is just adding ExportBulkAction to your bulk actions.

Example for admin package

Example for separate table package

Usage

Filament Excel comes with three actions you can use:

Without further configuration they will try to resolve the fields from the table or form definition and output an Excel file.

Multiple export classes

You can overwrite the default export class and also configure multiple exports with different settings. The user will be shown a modal to select the export class he wants to use.

Closure customization

Many of the functions for customising the export class, accept a Closure that gets passed dynamic data:

The following arguments are available:

Filename

The filename is set via ->withFilename():

Export types

You can set the file type via ->withWriterType():

Defining columns

When using ->fromForm()/->fromTable()/->fromModel() the columns are resolved from your table or form definition. You can also provide columns manually, append columns or overwrite generated columns.

You can also include only a subset of columns (->only()) or exclude certain ones (->except()):

When you neither pass ->only() nor ->except() the export will also respect the $hidden attributes of your model, for example the password on the user model. You can disable this by passing an empty array ->except([]).

Headings

When using ->fromForm()/->fromTable()/->fromModel() the headings are resolved from your table or form definition. You can also overwrite headings:

If you want to use the column names and don't like the headings auto generated you can use ->withNamesAsHeadings(). To disable headings entirely you can append ->withoutHeadings()

Formatting

Every column can be formatted by providing a Closure. Additional to the default parameters you get access to $state and $record.

Columns are auto-scaled to fit the content. If you want to overwrite this with a custom column width you can do so:

The underlying package PhpSpreadsheet provides various options for Excel column formatting. Inspect the NumberFormat list for the full list.

Ignore Formatting

When using ->fromForm()/->fromTable() the formatting is resolved from your table or form definition. If you don't want to overwrite every columns ->formatStateUsing() method, you can ignore the formatting altogher or for specific columns by using ->ignoreFormatting():

Formatters

When the state of column is not a string, it is run through a formatter even if you use ->ignoreFormatting() to make sure it's in the right format for Excel.

Currently there are 3 formatters: ArrayFormatter, EnumFormatter and ObjectFormatter. You can swap out any implementation via Laravel's service container, for example to use a different delimiter for the ArrayFormatter:

User input

You can let the user pick a filename and writer type by using ->askForFilename() and ->askForWriterType():

You can also use the users input inside a Closure:

Modify the query

You can modify the query that is used to retrieve the model by using ->modifyQueryUsing():

Queued exports

Exports for resources with many entries can take some time and therefore can be queued with ->queue(). They will be processed in background jobs and the user will be notified with a notification on the next page load (or when Livewire is polling).

The temporary file will be deleted after the first download. Files that are not downloaded will be deleted by a scheduled command after 24 hours.

The size of exported records per Job can be adjusted by using ->withChunkSize():

Custom exports

If you need even more customization or want to clean up your resources by separating the export code, you can extend the ExcelExport class and configure it using setUp():

Contributing

If you want to contribute to this packages, you may want to test it in a real Filament project:

Install the packages in your app's composer.json:

Now, run composer update.

Credits

This package is based on the excellent Laravel Nova Excel Package by SpartnerNL and ported to Filament.


All versions of filament-excel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
filament/filament Version ^3.0.0-stable
maatwebsite/excel Version ^3.1
anourvalar/eloquent-serialize Version ^1.2
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 pxlrbt/filament-excel contains the following files

Loading the files please wait ....