Development
----------

```bash
cd /tmp
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
sudo mv composer.phar /usr/local/bin/composer
composer global require "laravel/installer"
sudo apt-get install php-zip php-xdebug
sudo tee -a /etc/php/7.0/apache2/php.ini <<EOF

[Xdebug]
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.profiler_enable=1
EOF
sudo service apache2 restart
```

Installation
-----------

```bash
# Install Apache & php prerequisites 
sudo apt-get install apache2 libapache2-mod-php7.0 php-xml php-common php-mbstring php-mysql

# Setting up the hostname
ENTITIES_LOGGER_HOSTNAME=www.entities-logger.cz       # CHANGE ME ! (if neccessary)
DOCUMENT_ROOT=$PWD/entities_logger/public            # CHANGE ME ! (if neccessary) - but keep the public folder!

APACHE_SITE_NAME=765-entities-logger                 # CHANGE ME ! (if neccessary)

# Add this apache configuration to available configurations
APACHE_SITE_PATH="/etc/apache2/sites-available/${APACHE_SITE_NAME}.conf"
sudo cp "$PWD/apache.conf" "$APACHE_SITE_PATH"

# Replace placeholders in configuration with values defined above
sudo sed -i "s:ENTITIES_LOGGER_HOSTNAME:$ENTITIES_LOGGER_HOSTNAME:g" "$APACHE_SITE_PATH"
sudo sed -i "s:DOCUMENT_ROOT:$DOCUMENT_ROOT:g" "$APACHE_SITE_PATH"

# Generate SSL 
sudo openssl req -x509 -nodes -newkey rsa:4096 -keyout /etc/ssl/private/entities-logger.key -out /etc/ssl/private/entities-logger.pem -days 3650 -subj "/CN=$ENTITIES_LOGGER_HOSTNAME"

# Enable site configuration
sudo a2ensite "$APACHE_SITE_NAME"

# Enable required apache mods
sudo a2enmod rewrite
sudo a2enmod ssl

# Apply all changes
sudo service apache2 restart

# Enable apache to write data into storage & bootstrap/cache
sudo chown www-data: entities_logger/bootstrap/cache/ -R
sudo chown www-data: entities_logger/storage -R

```
