# DPSVR On-Screen Browser Installation

This package includes a browser-based installer for non-developers.

## Before opening the installer

1. Upload and extract the application package on your server.
2. Point your domain or subdomain to the Laravel `/public` folder.
3. Create a MySQL database and database user in your hosting control panel.
4. Make sure the following folders are writable by the web server:
   - `storage`
   - `bootstrap/cache`
5. Make sure PHP 8.2+ and the required PHP extensions are enabled.

## Open the installer

Visit this URL in your browser:

```text
https://your-domain.com/install.php
```

The installer screen will check the server and ask for:

- Application name
- Application URL
- Database host, port, name, username and password
- First Super Administrator name, email and password
- Whether to install demo data
- Whether to run Composer Install from the browser if vendor files are missing

## What the installer does

The browser installer will:

1. Test the database connection.
2. Create or update `.env`.
3. Run Composer Install if allowed and available.
4. Generate the Laravel application key.
5. Run migrations.
6. Seed roles and permissions.
7. Seed PMS, AGO and DPK fuel products.
8. Create the first Super Administrator account.
9. Optionally install demo station data.
10. Create the storage symlink.
11. Cache configuration.
12. Create an installation lock file.

## After installation

Open:

```text
https://your-domain.com/login
```

Log in with the Super Administrator email and password entered during installation.

## Important security step

After installation, delete this file from the server:

```text
public/install.php
```

The installer also creates this lock file:

```text
storage/app/dpsvr_installed.lock
```

If this lock file exists, the browser installer will not run again.

## If Composer cannot run from the browser

Some shared hosting accounts disable browser command execution. If the installer says Composer cannot run, ask your server person to SSH into the application root and run:

```bash
composer install --no-dev --optimize-autoloader
php artisan key:generate --force
php artisan migrate --force
php artisan db:seed --class=RolePermissionSeeder --force
php artisan db:seed --class=FuelProductSeeder --force
php artisan dpsvr:install-admin --name="Super Administrator" --email="your@email.com" --password="your-password"
php artisan storage:link
php artisan config:cache
```

Then return to the browser installer or open `/login`.
