PHPackages                             juniorzavaleta/mysql-csv - 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. juniorzavaleta/mysql-csv

ActiveLibrary

juniorzavaleta/mysql-csv
========================

Export csv with mysql easier

v1.0(8y ago)038MITPHPPHP &gt;=5.6.4

Since Jun 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/JuniorZavaleta/MySqlCsvExporter)[ Packagist](https://packagist.org/packages/juniorzavaleta/mysql-csv)[ RSS](/packages/juniorzavaleta-mysql-csv/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

MySql Exporter
==============

[](#mysql-exporter)

Create a csv file from mysql

Installation
------------

[](#installation)

composer require

Mysql Configuration
-------------------

[](#mysql-configuration)

Add the csv folder to file /etc/apparmor.d/usr.sbin.mysqld

```
/usr/sbin/mysqld {
    [...]
    # Allow data files dir access
    /var/lib/mysql-files/ r,
    /var/lib/mysql-files/** rwk,

    /path/to/project/csv/ r,
    /path/to/project/csv/* rwk,
    [...]
}

```

then run

```
sudo /etc/init.d/apparmor reload

```

Maybe have problems with secure-file-priv, change on mysql config

```
[mysqld]
secure-file-priv = ""

```

```
sudo service mysql restart

```

### Example

[](#example)

On Laravel or a framework with the function env() with the same behavior

The second arg of the constructor are credentials for mysql, check source code

```
$generator = new CsvGenerator('complaints');

$generator->setTitles(
    'Id',
    'Tipo contaminacion',
    'Distrito',
    'Estado',
    'Fecha de registro'
);

$generator->setColumns(
    'complaints.id',
    'contamination_types.description',
    'districts.name',
    'complaint_states.description',
    'complaints.created_at'
);

$generator->setFilename(storage_path('app/csv/casos_'.date('d_m_Y_H_i_s').'.csv'));

$generator->join('contamination_types', 'complaints.type_contamination_id', 'contamination_types.id')
    ->join('districts', 'complaints.district_id', 'districts.id')
    ->join('complaint_states', 'complaints.complaint_state_id', 'complaint_states.id');

if (!$user->is_admin) {
    $generator->where('complaints.district_id', session('district_id'))
              ->whereNot('complaint_state_id', Complaint::INCOMPLETED);
}

$generator->whereIf('complaint_states.description', request('estado'))
          ->whereIf('districts.name', request('distrito'))
          ->whereIf('contamination_types.description', request('tipo_contaminacion'))
          ->orderBy('complaints.id', 'DESC');

$filename = $generator->execute();

return response()->download($filename)->deleteFileAfterSend(true);
```

Export!

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Unknown

Total

1

Last Release

3259d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd976103db6f28488308bd6e4fc4d7dbc2e8efb4e515c7c242ac8ae08d3af6ed?d=identicon)[JuniorZavaleta](/maintainers/JuniorZavaleta)

---

Top Contributors

[![shuni95](https://avatars.githubusercontent.com/u/9482610?v=4)](https://github.com/shuni95 "shuni95 (13 commits)")

### Embed Badge

![Health badge](/badges/juniorzavaleta-mysql-csv/health.svg)

```
[![Health](https://phpackages.com/badges/juniorzavaleta-mysql-csv/health.svg)](https://phpackages.com/packages/juniorzavaleta-mysql-csv)
```

PHPackages © 2026

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