mrshoikot/securecsv

A Laravel package that encrypts one or more columns from a table and export them into CSV

dev-main 2023-08-20 05:26 UTC

README

A Laravel package that encrypts one or more columns from a table and export them into CSV.

Environment

This package was tested using php 8.1 and laravel 10.0

Installation

You can install the package via composer:

composer require mrshoikot/securecsv:dev-main"

Usage

use Mrshoikot\EncryptAndExport\EncryptAndExport;

$exporter = new EncryptAndExport();
$exporter->setTable('TABLE_NAME');
$exporter->selectColumn('COLUMN_NAME');
$exporter->setPath(storage_path('exports')); // Default is /storage/app
$exporter->export();

The selectColumn() method also accepts array of column names.

To use the package from command line. You have to run

php artisan securecsv

A prompt will ask you from which table you want to export the data and also ask you to choose the columns you want to encrypt. You'll also be asked the path where the exported CSV file should be stored. The default is the root directory of your project.

Testing

composer test

TODO

  • Implement API usability along with CLI
  • Write unit and more feature tests
  • Enable and test support for older versions of PHP and Laravel
  • Include option for having CSV header
  • Add ability for selecting multiple column at once

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.