Download the PHP package akki/bulkexportcsv without Composer

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

Export Unlimited Records into CSV

Latest Stable Version License

Introduction

This package will help you in exporting unlimited data using laravel's eloquent query and json resource. It is based on queue batching of laravel. It supports all databases eloquent supports.

Installation

Install BulkExportCSV:

Publish the config file config/bulkexportcsv.php, model App\Models\BulkExportCSV.php, migration bulk_export_csv table, events and listeners:

Prepare Migration of queue tables:

Miragte tables:

Usage

Make a query

Prepare an eloquent query, make sure query does not have get(), first(), skip(), limit() methods. By Default package will export all records query gives.

Make a JSON resource

UserResource.php:

Export into CSV

build method will start the export CSV process.

build method returns BulkExportCSV modal which is pointed to published bulk_export_csv table, it gives all information regarding CSV request. If data to export is less, one can use download method.
But, Before exporting into CSV using build method, Make sure to fill up config/bulkexportcsv.php correctly which is shown below.

Configuration

Edit config/bulkexportcsv.php to suit your needs.

Events

When CSV starts to get prepared throught queue jobs, these are typical events that happens: CSV starts to get prepared => Queue jobs gets completed => Queue batching has completed and CSV is prepared successfully or Queue batching has stopped because of exception. To handle this each event, package publishes events and their respective listeners: 1) BulkExportCSVStarted: This event gets triggered when CSV starts to get prepared 2) BulkExportCSVJobCompleted: This event gets triggered for each queue job when that particular job gets completed. 3) BulkExportCSVSucceeded: This event gets triggered when CSV gets perpared successfully, i.e. queue batching has successfully completed. 4) BulkExportCSVFailed: This event gets triggered when any particular queue job throws an exception and so stops queue batching process, so CSV does not get prepared successfully.
Each of these events gets BulkExportCSV modal as a parameter. You can broadcast this events, we recommend using ShouldBroadcastNow interface so event gets broadcast in sync with queue jobs.

bulk_export_csv table

When CSV starts to get prepared, you can access its current status using published "bulk_export_csv" table which has following columns. BulkExportCSV modal points to this table:

Queue Configuration

Make sure you have filled up config/queue.php correctly. Install Supervisor, in its configuration file, command must mention queue name used for bulkExportCSV. For example, in config/bulkexportcsv.php if queue name is bulkExportCSV then command must be:

Of course, You can specify which queues queue worker should process by priority depending on your needs. If you are broadcasting events using ShouldBroadcast interface make sure to add its queue name here too on which it is broadcasting.

More Options in 'build' method of 'BulkExportCSV'

Define Columns for Export CSV

By default, package takes columns names from json resource itself. But one can define custom columns as required:

Access Request Data in Resource

Often times, we need authenticated user data or request data in json resource. As export CSV happens in background, there is no access to request, but one can send data to json resource or even eloquent model accessors or event listeners by using config('bulkexportcsv.data'):

JSON Resource:

csv_info key in data array is specifically accessible on BulkExportCSV model as $bulkExportModal->config->csv_info.

Make sure to restart queue workers, if one does changes in json resource.

Extra Methods

Package uses Akki\BulkExportCSV\Models\BulkExportCSVModel model to access "bulk_export_csv" table. This model extends from published App\Models\BulkExportCSV model.

findByJobsId

To fetch record from "bulk_export_csv" table using jobs_id, one can use findByJobsId method:

cancelExportCSVProcess

To cancel ongoing export csv process, one can use cancelExportCSVProcess method:

Download CSV

If one wants to download CSV directly instead of going though queue job process, then use download method:

Here, one can also pass Columns and Data parameters similar to build method. download method creates CSV on the fly i.e. without writing CSV on the server disk and returns downloadable CSV file to the browser. In frontend side, to force browser to download CSV directly, you need to let browser call the API, you can use location.href for it. If one prefers to call API from AJAX then in response download method gives content of CSV, so in frontend one can make CSV using blob.

If one is to use download method only, then there is no need of any configuration. One can use build and download method based on their prefer choice, if data to export is huge which one can know using count() method on eloquent, then better to go with build method otherwise download method can also be right choice.

Installation in LUMEN

Install BulkExportCSV:

Service provider should be registered manually as follow in bootstrap/app.php with enabling some additional required options:

If one gets error 'ReflectionException' with message 'Class path.storage does not exist', declare storage folder path in bootstrap/app.php right after $app definition:

If one gets error Target [Illuminate\Contracts\Routing\ResponseFactory] is not instantiable, add this in AppServiceProvider.php:

Copy the required files:

copy queue:table, queue:batches-table from laravel itself, migrate the tables:

Now you can follow the same Usage mentioned for Laravel above.

Learning Resource

There is a video series available on youtube to know how to use this package, Click Here.

Contribution

You can contribute to this package by discovering bugs and opening issues. Please, add to which version of package you create pull request or issue. (e.g. [1.0.0] Fatal error on build method)


All versions of bulkexportcsv with dependencies

PHP Build Version
Package Version
Requires anourvalar/eloquent-serialize Version ^1.2
php Version ^7.3|^8.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 akki/bulkexportcsv contains the following files

Loading the files please wait ....