PHPackages                             iyogesharma/export - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. iyogesharma/export

ActiveProject[PDF &amp; Document Generation](/categories/documents)

iyogesharma/export
==================

Export data in database to various file format

1.5(1y ago)14371MITPHPPHP &gt;=7.0.0

Since Sep 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/iYogesharma/export)[ Packagist](https://packagist.org/packages/iyogesharma/export)[ RSS](/packages/iyogesharma-export/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (9)Used By (1)

Export
======

[](#export)

Export data in database to various file format . Currently xls,json and csv file formats are supported

Example
-------

[](#example)

###### Using Eloquent

[](#using-eloquent)

```
  use YS\Export\Csv;
  use App\User;

  public function exportUsers()
  {
      $csv = new Csv( User::select('*'));
      return $csv->response();
  }
```

###### Using DB Facade

[](#using-db-facade)

```
  use YS\Export\Csv;
  use App\User;

  public function exportUsers()
  {
      $csv = new Csv( DB::table('users')->select('name','email'));
      return $csv->response();
  }
```

###### Using Joins in query

[](#using-joins-in-query)

```
use YS\Export\Csv;
use App\User;

 public function exportUsers()
 {
     $query = User::join('companies', 'companies.id','users.company_id')->select('users.name','users.email','companies.name as company');
     $csv = new Csv( $query );
     return $csv->response();
 }
```

### Similarly you can use Json and Excel export

[](#similarly-you-can-use-json-and-excel-export)

```
  use YS\Export\Json;
  use App\User;

  public function exportUsers()
  {
      $json = new Json( DB::table('users')->select('name','email'));
      return $json->response();
  }
```

```
  use YS\Export\Xls;
  use App\User;

  public function exportUsers()
  {
      $xls = new Xls( DB::table('users')->select('name','email'));
      return $xls->response();
  }
```

```
use YS\Export\ArrayToXls;
use App\User;

/**
 * $data array of records to be exported
 * eg,  $data = [
    ['name' => 'user', 'email' => 'user@test.com','contact' => 123456789],
    ['name' => 'user1', 'email' => 'user1@test.com', 'contact' => 123456789]
  ]
 * bool $export with default value as true indicate weather to export data or not
 * string $fileName name of the file to be exported
 * array  $headers with default value as [] if values provided with export only provided columns
 * eg, headers = ['name','email'] will export only name and email not contact
 */

public function exportUsers()
{
  $xls = new ArrayToXls($data,$export,$fileName,$headers); // will export only name and email
  return $xls->response();
}
```

You can provide column names inside select statement in order to export only selected columns from database.Optionally you can also define column names inside ys-export config file which you do not want to export in file like id,password etc...

 To do this just run php artisan vendor:publish and select ys-export:config group

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~163 days

Recently: every ~256 days

Total

8

Last Release

557d ago

Major Versions

1.4 → 3.x-dev2024-11-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/6df6c987f76f76f4d8e7873b6983b44e16d72d39b3adf711a8e13f74e5b6fe29?d=identicon)[iYogesharma](/maintainers/iYogesharma)

---

Top Contributors

[![iYogesharma](https://avatars.githubusercontent.com/u/44565761?v=4)](https://github.com/iYogesharma "iYogesharma (16 commits)")

---

Tags

laravelexportcsviYogesharma

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/iyogesharma-export/health.svg)

```
[![Health](https://phpackages.com/badges/iyogesharma-export/health.svg)](https://phpackages.com/packages/iyogesharma-export)
```

###  Alternatives

[maatwebsite/excel

Supercharged Excel exports and imports in Laravel

12.7k144.3M712](/packages/maatwebsite-excel)[bfinlay/laravel-excel-seeder

Seed the database with Laravel using Excel, XLSX, XLS, CSV, ODS, Gnumeric, XML, HTML, SLK files

3944.4k](/packages/bfinlay-laravel-excel-seeder)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
