PHP ETL
  • Introduction
  • Getting Started
  • Extractors
    • Collection
    • CSV
    • Fixed Width
    • JSON
    • Query
    • Table
    • XML
  • Transformers
    • Convert Case
    • JSON Decode
    • JSON Encode
    • Rename Columns
    • Trim
    • Unique Rows
  • Loaders
    • Insert
    • Insert/Update
  • Helpers
  • Running Processes
Powered by GitBook
On this page
  • Options
  • Columns
  • Type
  • Mask
  1. Transformers

Trim

Strip whitespace (or other characters) from the beginning and/or end of a string.

$etl->transform('trim', $options);

Options

Columns

Columns that will be transformed. If empty, the transformation is applied to all columns.

Type

Default value

array

[]

$options = ['columns' => ['name', 'email']];

Type

The options trim | all | both will trim both sides, ltrim | start | left will trim the left side and rtrim | end | right will trim the right side of the string.

Type

Default value

string

both

$options = ['type' => 'right'];

Mask

The stripped characters. Simply list all characters that you want to be stripped. With .. you can specify a range of characters.

Type

Default value

string

" \t\n\r\0\x0B"

$options = ['mask' => '|'];
PreviousRename ColumnsNextUnique Rows

Last updated 6 years ago