# Getting Started

## Installation

In your application's folder, run:

```
composer require marquine/php-etl
```

## Database Configuration

If you are working with ETL, you probally need to read and/or write to databases. Currently, we support MySQL, PostgreSQL, SQL Server and SQLite.

These are the configuration parameters for each database driver:

* MySQL

  ```php
  $config = [
    'driver' => 'mysql',
    'host' => 'localhost',
    'port' => '3306',
    'database' => 'database',
    'username' => 'user',
    'password' => 'password',
    'charset' => 'utf8',
    'collation' => 'utf8_unicode_ci',
  ];
  ```
* PostgreSQL

  ```php
  $config = [
    'driver' => 'pgsql',
    'host' => 'localhost',
    'port' => '5432',
    'database' => 'database',
    'username' => 'user',
    'password' => 'password',
    'charset' => 'utf8',
    'schema' => 'public',
  ];
  ```
* SQL Server

  ```php
  $config = [
    'driver' => 'sqlsrv',
    'host' => 'localhost',
    'port' => '1433',
    'database' => 'database',
    'username' => 'user',
    'password' => 'password',
  ];
  ```
* SQLite

  ```php
  $config = [
    'driver' => 'sqlite',
    'database' => '/path/to/database.sqlite',
  ];
  ```

### Adding connections

Adding the default connection:

```php
use Marquine\Etl\Etl;

Etl::service('db')->addConnection($config); // connection name: 'default'
```

You can add more connections passing a name as the second argument to the `addConnection` method:

```php
use Marquine\Etl\Etl;

Etl::service('db')->addConnection($config, 'name');
```

## Laravel Integration

If you are using Laravel 5.5 or greater, the package will automatically register all database connections.

For other versions, you need to add the ServiceProvider to the `providers` array in the `config/app.php` file:

```php
Marquine\Etl\EtlServiceProvider::class,
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://php-etl.gitbook.io/docs/gettingstarted.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
