Download the PHP package shimabox/smbarrayto without Composer
On this page you can find all versions of the php package shimabox/smbarrayto. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package smbarrayto
SMBArrayto
Array to csv, tsv, ltsv, xml, json, ...
Overview
- Array to csv, tsv, ltsv, xml, json, ...
- And provides a download function, output function, write function
Requirements
- PHP 5.4+ or newer
- Composer
- GitHub - fjyuu/monolog-ltsv-formatter: LTSV Formatter for Monolog
- GitHub - spatie/array-to-xml: A simple class to convert an array to xml
Installation
Basic Usage
In the case of csv download
- It does not create the actual file
- It makes use of the temporary file
- Use the header function
or
Result
- The default line feed code (only csv, tsv)
- The default encoding (only csv, tsv)
- Please perform the following if you want to change this
-
e.g.)
- Line feed code is
- Encoding is
Example
- Use basically the following three interfaces
- It does not create the actual file (csv, tsv)
- It makes use of the temporary file
- Use the header function
- It does not create the actual file (csv, tsv)
- It makes use of the temporary file
- Use the header function
- Simply echo()
- Need to specify the path where you want to save by setFileName()
In the case of CSV
download($fileName);
output();
write();
In the case of TSV
- With csv interface
CSV, TSV configuration
-
- You can set the header row
-
- You can clear the header row
-
- The default is
- Convert the line feed code to
- To convert the encoding to
- If you set the , it does not perform the conversion
In the case of LTSV
download($fileName);
Result
output();
- It does nothing
write();
LTSV configuration
-
- You can override the line feed code
- The default line feed code is
- e.g.)
In the case of XML
download($fileName);
Result
output();
- It does nothing
write();
XML configuration
-
- You can set the root element name
- Default of the root element name is the
-
- Set to enable replacing space with underscore
- The default is
-
- Nicely formats output with indentation and extra space
- The default is
- If you set the , it does not format
- e.g.)
Result
In the case of Json
download($fileName)
Result
output();
write();
JSON configuration
-
- You can override the json_encode options
- PHP: json_encode - Manual - options
- The default is
- e.g.)
Result
Other functions of the Downloader
-
- Download an existing file
-
- Download an existing file using Writer
- Download after the writing of the file
Configuration
@see
-
- Add the row
Result
-
- To add a specified row keys and values
Result
-
- Whether set to allow duplicate keys
- The default is
- csv,tsv behaves as false
- If you set the , it does not allow duplicate keys
- e.g.)
Result
Configuration for write
@see
-
- Specify where to save the file path (is a required value)
- or or ...
-
- Specify the open mode of the file
- The default open mode is
- PHP: fopen - Manual - A list of possible modes for fopen()
- e.g.)
Result
-
- You can set the file permissions
- The default permission is
- e.g.)
Other methods of instantiation
Testing
License
The MIT License (MIT). Please see License File for more information.
開発時の検証とカバレッジ
開発テストは PHP 7.2 以上と PHPUnit 8.5 を使用します。ライブラリ本体の PHP バージョン要件は変更していません。GitHub Actions でテストと依存のセキュリティ監査を実行し、Xdebug で生成した Clover カバレッジを coverage-php-<PHPバージョン> アーティファクトとして保存します。CodeClimate への外部送信は終了しています。
All versions of smbarrayto with dependencies
hikaeme/monolog-ltsv-formatter Version ^1.1
spatie/array-to-xml Version ^2.2