# Console

> Starting from v1.4.0 Easy!Appointments has introduced CLI support, providing a set of useful utilities to use with your installation.

Source: https://easyappointments.org/documentation/console/

> This page contains information about the CLI support of Easy!Appointments.

### Introduction

Starting from v1.4.0 Easy!Appointments has introduced CLI support, providing a set of useful utilities to use with your installation.

The commands can be executed with PHP installed on your server and available from within the terminal. To ensure that you have PHP configured properly run the following command from within a terminal session.

```bash
php -v
```

It shall give you information about the currently installed PHP version.

The available commands are described below.

### Commands

The entry point for the CLI commands is the root `index.php` file which means that you will be calling this file with additional arguments, depending on which command you want to run.

##### Migrate

```bash
php index.php console migrate
```

This command will migrate the database to the latest state.

```bash
php index.php console migrate fresh
```

This command will reset any change made by the previous migrations and start from the beginning. All existing data is lost, so only use it on a test installation.

```bash
php index.php console migrate up
php index.php console migrate down
```

These commands move the database one migration forward or back from its current version.

##### Seed

```bash
php index.php console seed
```

This command will add test data to the app, so that you can already run some tests: placeholder company settings, an admin (username `administrator`, password `administrator`), a provider, a customer and a service.

##### Install

```bash
php index.php console install
```

This command will perform a CLI installation of Easy!Appointments. It runs `migrate fresh` followed by `seed`, so any existing data in the database is removed, and when it is done it prints the administrator credentials to log in with. Change that password right away.

You can run this after your are done configuring your app from the root `config.php` file.

##### Backup

```bash
php index.php console backup
```

This command will create a backup of the application data in the `storage/backups` directory.

```bash
php index.php console backup /path/to/backup/folter
```

You can also provide a custom directory for your backup files.

##### Sync

```bash
php index.php console sync
```

This command will trigger the calendar synchronization for every provider that has Google Calendar or CalDAV sync enabled. Providers with both enabled are synced with both.

It is especially important, because it can be automatically executed on a regular base with a cron job.

This way the app provider schedules will always be updated.

##### Cleanup

```bash
php index.php console cleanup
```

This command removes expired sessions, old logs and cache files, and deletes old customer data according to the data retention settings configured in the backend. Like `sync`, it is meant for a cron job rather than a one-off run.

##### Help

```bash
php index.php console help
```

This command will give more information about the console capabilities.
