exceldb/dbtoexcel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

exceldb/dbtoexcel

最新稳定版本:1.0.0

Composer 安装命令:

composer require exceldb/dbtoexcel

包简介

PHP script to simplify the process of converting database table to excel sheet.

README 文档

README

PHP script to simplify the process of converting database table to excel sheet.

# Requirements

  • PHP 7.0 or higher
  • Composer for installation

# Install

via composer

composer require exceldb/dbtoexcel

# Example

// don't forget to import vendor/autoload.php
require('vendor/autoload.php'); 

// Database information
$extract = new Database\Excel\ExtractExcel([
      'driver' => 'mysql',
      'host' => '127.0.0.1',
      'username' => 'root',
      'password' => '',
      'database' => 'test',
      'port' => '3306',
      'charset' => 'utf8',
      'sslmode' => 'disable'
]);

$extract->table('users'); // Specify the database table.
$extract->columns('*'); // Specify the columns you need to extract.
$extract->execute(); // Execute the script.

# Description

The TableToExcel class constructor takes one parameter, which is an (array) of the database information.

table()

This method used to specify the database table you need to extract, it takes one parameter (string) which is the name of the table.

columns()

Used to specify the columns you need to extract from the database table, it takes one parameter (string) which is the column's names.

To extract all columns just add asterisk (*) or leave the parameter empty while if you want to extract specific columns you can write the columns names following by comma separator.. see the example below.

use ExtractDatabaseToExcel\TableToExcel;

$extract = new TableToExcel([
      'driver' => 'mysql',
      'host' => '127.0.0.1',
      'username' => 'root',
      'password' => '',
      'database' => 'test',
      'port' => '3306',
      'charset' => 'utf8'
]);

$extract->table('users');
$extract->columns('username, email, age'); // Extract specific columns
$extract->execute();

execute()

This is the last method you should invoke to execute the script, the method will convert the data and download the excel file.

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-02-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固