# Setup

# Laravel

# What is Laravel?

The Aero platform is built using the [Laravel PHP framework](https://laravel.com/).

Laravel is a free, open-source PHP web framework designed to make building scalable web applications easier and faster by providing pre-built components and structure.

Before developing with Aero, we recommend that you become acquainted with the core concepts of Laravel. We recommend the following resources:

- The official [Laravel documentation](https://laravel.com/docs) is a great place to start
- [Laracasts](https://laracasts.com/) offer an on‑demand library of screencast video tutorials

# Installation

# How do I install Aero?

## Required Services

First, we need to install a few required services.

### Composer

A dependency manager for PHP ([Download Composer](https://getcomposer.org/download/)).

### Node.js

A **JavaScript** runtime that lets you run tools and apps outside of the browser ([Download Node.js](https://nodejs.org/en/download)).

### Laravel Herd

An all-in-one local development environment for Laravel and PHP,

- MacOS: [Installation guide for MacOS](https://herd.laravel.com/docs/macos/getting-started/installation)
- Windows: [Installation guide for Windows](https://herd.laravel.com/docs/windows/getting-started/installation)

<p class="callout warning">If not using Herd Pro you'll need to run MySQL yourself, we suggest using DBngin ([Download DBngin](https://dbngin.com/download)).</p>

<p class="callout info">If needed, you can secure a Herd site by clicking the lock next to its name in the Site Manager (See [herd docs](https://herd.laravel.com/docs/macos/sites/securing-sites)).</p>

### Docker

An open source container service provider ([Download Docker](https://www.docker.com/get-started/)).

## Setting up Agora

Agora is our platform for managing Aero projects. It allows organisations to oversee their projects, collaborate with agencies, and publish custom packages and/or themes. These packages and themes can be installed via Composer to extend or customise the functionality of any Aero store.

<p class="callout warning">You must apply to be an agency on Agora to be able to use Aero Commerce.</p>

### Applying to be an Aero Commerce Agency

You can begin the application process here: [https://agora.aerocommerce.com/register](https://agora.aerocommerce.com/register).

### Creating your Project Credentials

To create your project credentials, navigate to [https://agora.aerocommerce.com/projects](https://agora.aerocommerce.com/projects) and click the `New Project` button, then simply enter the project's name and optionally its domain.

## Elasticsearch

Elasticsearch is the search engine that we'll use for our store. To set it up, we will create a Docker container by running the following command in our terminal:

```bash
docker run -d \
  -p 9200:9200 \
  -m 1GB \
  -e "discovery.type=single-node" \
  -e "xpack.security.enabled=false" \
  elasticsearch:8.17.4
```

- `-d` Enables detached mode, meaning the container will run in the background without blocking the terminal.
- `-p 9200:9200` Maps port `9200` on your local machine (host) to port `9200` inside the container.
- `-m 1GB` Limits the container's memory usage to 1 GiB (else it will reserve 50% of your Docker memory).
- `-e "discovery.type=single-node"` Sets the environment variable to configure Elasticsearch to run in `single-node` mode.
- `-e "xpack.security.enabled=false"` Disables X-Pack security, meaning no authentication is required for accessing Elasticsearch.

<p class="callout info">You can check for the latest version to install instead of `8.17.4` [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/es-release-notes.html).</p>

<p class="callout info">You can ensure Elasticsearch is running by visiting [http://localhost:9200](http://localhost:9200/).</p>

## Creating your First Store

Before we can create our first store we must install the command-line installer tool using Composer, to do this run the following commands in your terminal:

First, install it globally:

```bash
composer global require aerocommerce/cli
```

Then, make sure to place Composer's system-wide vendor bin directory in your `$PATH`:

```bash
export PATH="$PATH:$HOME/.composer/vendor/bin"
```

Now we have global access to the `aero new` command in our terminal which we can use like so to create our first store:

```bash
aero new my-first-store --laravel=13
```

- `--laravel=[version]` Optionally specifies the laravel version to install.

<p class="callout info">You will be prompted to enter your Agora project credentials that you created earlier, you can find them [here](https://agora.aerocommerce.com/projects).</p>

### Storefront

You can view your storefront by navigating to [http://my-first-store.test](http://my-first-store.test) in your browser, which will be empty as your store has no listings.

### Admin

You can view the admin by navigating to [http://my-first-store.test/admin](http://my-first-store.test/admin) in your browser and logging in.

- **Username**: admin@example.com
- **Password**: aerocommerce

<p class="callout info">Upon logging in you will be prompted to change your password &amp; must do so before being able to navigate to other pages of the admin.</p>

### Importing Sample Data

First, enter the store’s directory, e.g.:

```
cd my-first-store
```

Then run the products import command (choose one of the below):

- Fashion: `herd php artisan aero:import:products:csv https://aero-data.s3.eu-west-2.amazonaws.com/products.csv`
- Furniture: `herd php artisan aero:import:products:csv https://aero-data.s3.eu-west-2.amazonaws.com/furniture.csv`

As well as the blocks import command (choose one of the below, inline with previous choice):

- Fashion: `herd php artisan aero:import:blocks:csv https://aero-data.s3.eu-west-2.amazonaws.com/blocks/fashion.csv`
- Furniture: `herd php artisan aero:import:blocks:csv https://aero-data.s3.eu-west-2.amazonaws.com/blocks/furniture.csv`

Finally, run your search queue:

```bash
herd php artisan queue:work --queue=search --timeout=0
```

Once done, navigate to [http://my-first-store.test](http://my-first-store.test) to see your imported products on the storefront or [http://my-first-store.test/admin/catalog/products](http://my-first-store.test/admin/catalog/products) to view them in the admin.

# What services does Aero require?

### Composer

A dependency manager for PHP ([Download Composer](https://getcomposer.org/download/)).

### Node.js

A **JavaScript** runtime that lets you run tools and apps outside of the browser ([Download Node.js](https://nodejs.org/en/download)).

### Laravel Herd

An all-in-one local development environment for Laravel and PHP,

- MacOS: [Installation guide for MacOS](https://herd.laravel.com/docs/macos/getting-started/installation)
- Windows: [Installation guide for Windows](https://herd.laravel.com/docs/windows/getting-started/installation)

<p class="callout warning">If not using Herd Pro you'll need to run MySQL yourself, we suggest using DBngin ([Download DBngin](https://dbngin.com/download)).</p>

<p class="callout info">If needed, you can secure a Herd site by clicking the lock next to its name in the Site Manager (See [herd docs](https://herd.laravel.com/docs/macos/sites/securing-sites)).</p>

### Docker

An open source container service provider ([Download Docker](https://www.docker.com/get-started/)).

# How do I import data?

First, enter the store’s directory, e.g.:

```
cd my-first-store
```

Then run the products import command (choose one of the below):

- Fashion: `php artisan aero:import:products:csv https://aero-data.s3.eu-west-2.amazonaws.com/products.csv`
- Furniture: `php artisan aero:import:products:csv https://aero-data.s3.eu-west-2.amazonaws.com/furniture.csv`

As well as the blocks import command (choose one of the below, inline with previous choice):

- Fashion: `php artisan aero:import:blocks:csv https://aero-data.s3.eu-west-2.amazonaws.com/blocks/fashion.csv`
- Furniture: `php artisan aero:import:blocks:csv https://aero-data.s3.eu-west-2.amazonaws.com/blocks/furniture.csv`

Finally, run your search queue:

```bash
php artisan queue:work --queue=search --timeout=0
```

# What queues does Aero use?

Queues are used so that HTTP requests can remain snappy and more intensive code can be executed later. You can [learn more about queues here](https://laravel.com/docs/6.x/queues).

<table border="1" id="bkmrk-queue-description-se" style="border-collapse: collapse; width: 100%;"><colgroup><col style="width: 50.0596%;"></col><col style="width: 50.0596%;"></col></colgroup><tbody><tr><td>**Queue**  
</td><td>**Description**  
</td></tr><tr><td>search</td><td>This queue has search jobs. The majority of these jobs will be responsible for reindexing listings.</td></tr><tr><td>email</td><td>This queue has email jobs. Whenever an email is sent and queued in your application, it will be in this queue.</td></tr><tr><td>subscriptions</td><td>This queue has subscription jobs. The majority of these jobs are responsible for creating and processing subscriptions.</td></tr><tr><td>default</td><td>This queue has any jobs that are not in one of the other queues. These jobs can be anything from order created event handlers to customer created event handlers.</td></tr></tbody></table>

Aero uses four queues so that you can have different workers completing different tasks without a risk of locks or jobs being handled more than once. It’s important to note that some queues should be considered more important than others (for example, processing events such as an order created event is more important than updating your search index). In a production environment you should use tools like [Supervisor](https://laravel.com/docs/6.x/queues#supervisor-configuration) to manage your queue workers.

You can use the queue work command to run all of or only specific queues (if you adjust the list of queues in the command). It’s important to note that the order of the queues in the command defines their priority.

# Agora

# What is Agora?

Agora is our platform for managing Aero projects. It allows organisations to oversee their projects, collaborate with agencies, and publish custom packages and/or themes. These packages and themes can be installed via Composer to extend or customise the functionality of any Aero store.

<p class="callout warning">You must apply to be an agency on Agora to be able to use Aero Commerce.</p>

##### Applying to be an Aero Commerce Agency

You can begin the application process here: [https://agora.aerocommerce.com/register](https://agora.aerocommerce.com/register).

##### Creating your Project Credentials

To create your project credentials, navigate to [https://agora.aerocommerce.com/projects](https://agora.aerocommerce.com/projects) and click the `New Project` button, then simply enter the project's name and optionally its domain.

# How can I apply to be an Aero Commerce Agency?

You can begin the application process here: [https://agora.aerocommerce.com/register](https://agora.aerocommerce.com/register).

# How can I create credentials for my Aero project?

To create your project credentials, navigate to [https://agora.aerocommerce.com/projects](https://agora.aerocommerce.com/projects) and click the `New Project` button, then simply enter the project's name and optionally its domain.

# Admin

# How do I view the Admin?

You can view the admin by navigating to [http://my-first-store.test/admin](http://my-first-store.test/admin) in your browser and logging in.

- **Username**: admin@example.com
- **Password**: aerocommerce

<p class="callout info">Upon logging in you will be prompted to change your password &amp; must do so before being able to navigate to other pages of the admin.</p>

# What are the default login credentials for the Admin?

- **Username**: admin@example.com
- **Password**: aerocommerce

<p class="callout info">Upon logging in you will be prompted to change your password &amp; must do so before being able to navigate to other pages of the admin.</p>

# How do I change the default admin slug?

You can change the default admin slug by setting a variable in your `.env`:

```
AERO_ADMIN_SLUG=admin-panel
```

# Storefront

# How do I view the Storefront?

You can view your storefront by navigating to [http://my-first-store.test](http://my-first-store.test) in your browser, which will be empty as your store has no listings.

### Importing Sample Data

First, enter the store’s directory, e.g.:

```
cd my-first-store
```

Then run the products import command (choose one of the below):

- Fashion: `herd php artisan aero:import:products:csv https://aero-data.s3.eu-west-2.amazonaws.com/products.csv`
- Furniture: `herd php artisan aero:import:products:csv https://aero-data.s3.eu-west-2.amazonaws.com/furniture.csv`

As well as the blocks import command (choose one of the below, inline with previous choice):

- Fashion: `herd php artisan aero:import:blocks:csv https://aero-data.s3.eu-west-2.amazonaws.com/blocks/fashion.csv`
- Furniture: `herd php artisan aero:import:blocks:csv https://aero-data.s3.eu-west-2.amazonaws.com/blocks/furniture.csv`

Finally, run your search queue:

```bash
herd php artisan queue:work --queue=search --timeout=0
```

# Elasticsearch

# How do I setup Elasticsearch for my store?

To set it up Elasticsearch we will create a Docker container by running the following command in our terminal:

```bash
docker run -d \
  -p 9200:9200 \
  -m 1GB \
  -e "discovery.type=single-node" \
  -e "xpack.security.enabled=false" \
  elasticsearch:8.17.4
```

- `-d` Enables detached mode, meaning the container will run in the background without blocking the terminal.
- `-p 9200:9200` Maps port `9200` on your local machine (host) to port `9200` inside the container.
- `-m 1GB` Limits the container's memory usage to 1 GiB (else it will reserve 50% of your Docker memory).
- `-e "discovery.type=single-node"` Sets the environment variable to configure Elasticsearch to run in `single-node` mode.
- `-e "xpack.security.enabled=false"` Disables X-Pack security, meaning no authentication is required for accessing Elasticsearch.

<p class="callout info">You can check for the latest version to install instead of `8.17.4` [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/es-release-notes.html).</p>

<p class="callout info">You can ensure Elasticsearch is running by visiting [http://localhost:9200](http://localhost:9200/).</p>

# FAQs

# Can I use Aero project credentials across multiple projects?

No, Credentials must not be shared between projects.

# Is Laravel required to run Aero?

Yes, the Aero platform is built on top of the Laravel framework. Knowledge of Laravel is not essential for basic Aero development but will help with more complex actions and configurations.

# What versions of Elasticsearch does Aero support?

Aero supports both Elasticsearch `6.x`, `7.x` &amp; `8.x`.

Support for Elasticsearch `6.x` is provided by the `0.x` version of `aerocommerce/elastic-search`.

Support for Elasticsearch `7.x` &amp; `8.x` is provided by the `1.x` version of `aerocommerce/elastic-search`.

<p class="callout info">It is highly recommended to use at minimum `7.x`.</p>

# Which versions of PHP will Aero run on?

Aero requires PHP Version `7.2` and upwards.

# How do I configure the PHP memory limit?

Due to the number of fields that are sometimes present in the admin, it may be necessary to adjust the PHP `max_input_vars` value.

The default of `1,000` fields can be too small when managing a product that contains hundereds of variants. This limit is quickly reached when considering how many fields each variant has.

A form that contains more fields than PHP is configured to accept will result in lost or corrupted data.

The `max_input_vars` value is defined in the php.ini file. On a Linux server, this is typically located:

```
# PHP 7.3
/etc/php/7.3/php-fpm/php.ini

# PHP 7.4
/etc/php/7.4/php-fpm/php.ini

# PHP 8.0
/etc/php/8.0/php-fpm/php.ini
```

On macOS when using Homebrew:

```
# PHP 7.3
/usr/local/etc/php/7.3/php.ini

# PHP 7.4
/usr/local/etc/php/7.4/php.ini

# PHP 8.0
/usr/local/etc/php/8.0/php.ini
```

We recommend a value of `10,000`. You should either search for the existing entry, or add to the bottom of the file:

```
max_input_vars=10000
```

Once set, you'll need to reload PHP-fpm.

```
# Linux (PHP 7.3)
sudo service php7.3-fpm reload

# Linux (PHP 7.4)
sudo service php7.4-fpm reload

# Linux (PHP 8.0)
sudo service php8.0-fpm reload

# macOS (Laravel Valet)
valet restart
```