USAFI | Install on Truehost cPanel
=================================

This package contains the complete PHP app, website assets, and SQL for a
fresh installation. All frontend assets are included. No Composer or Node.js
installation is required.

Included folders:
  usafi.co.ke/    Website files for your domain's document root
  usafi-app/      Private PHP application and configuration template
  usafi-install/  This guide and schema.sql

1. Prepare the domain and PHP
   In Truehost, open cPanel > Domains. Confirm the document root for
   usafi.co.ke. A main domain normally uses /home/<account>/public_html.
   An addon domain may use /home/<account>/usafi.co.ke or
   /home/<account>/public_html/usafi.co.ke. Use the path listed in cPanel.
   Back up any existing site before copying files into its document root.
   Select PHP 8.2 or later and make sure pdo_mysql and mbstring are enabled.

2. Upload and place the files
   In cPanel > File Manager, enable Show Hidden Files (dotfiles) in Settings.
   Create a temporary folder in your account home, outside all document
   roots. Upload the ZIP and extract it there.

   Move usafi-app/ to /home/<account>/usafi-app/ so that bootstrap.php is
   directly inside it. Copy the CONTENTS of usafi.co.ke/ (index.php,
   .htaccess, and assets/) into the document root listed in step 1. The
   domain's document root should contain index.php directly. Keep the ZIP,
   usafi-app/, and usafi-install/ outside all public folders.

3. Create the database
   In cPanel > Database Wizard (or MySQL Database Wizard), create a new empty
   MySQL or MariaDB database and a dedicated user. Assign the user to the
   database with all privileges for that database. Save the full database and
   user names, including the cPanel prefix. Open phpMyAdmin, select the new
   database, click Import, and choose usafi-install/schema.sql from your local
   copy of the ZIP. Wait for the import to finish.

4. Set the private configuration
   In /home/<account>/usafi-app/, copy config.example.php to config.local.php.
   Edit config.local.php in File Manager and set these values:

     app_env        production
     base_url       https://www.usafi.co.ke (or your exact HTTPS domain)
     db_host        localhost, unless Truehost gives you another host
     db_port        3306, unless Truehost gives you another port
     db_name        full cPanel database name
     db_user        full cPanel database username
     db_password    the database user's password
     setup_token    a fresh, private random value of at least 32 characters

   Keep the PHP array syntax and its quotes when editing. In a PHP single
   quoted value, escape a single quote as \' and a backslash as \\.
   Generate your own setup token with a password manager, or run this in
   cPanel Terminal (if available) or on a computer with PHP:

     php -r 'echo bin2hex(random_bytes(32)), PHP_EOL;'

5. Enable HTTPS and create the administrator
   Point the domain and www to your Truehost service at the authoritative DNS
   provider if they are not already pointed there. In cPanel > SSL/TLS Status,
   confirm there is a valid certificate for the public domain (both apex and
   www if you use both). Run AutoSSL if offered. Open the HTTPS base URL with
   /?p=setup appended (for example https://www.usafi.co.ke/?p=setup).
   Enter your setup token and choose the administrator email and password.
   After creating the administrator, remove the token value from
   config.local.php, leaving 'setup_token' => ''.

6. Check the site
   Sign in as the administrator. Open the homepage and services page. Verify
   that the page loads with its images and styles; then test registration and
   booking before accepting live customers. Provider listings are populated
   when real providers register, set up their profiles, and are approved.
   Set support_email and mail_from if you want password reset emails, and
   configure mpesa_topup_instructions if you want manual wallet top-ups.

If the app says setup is pending, check that usafi-app/bootstrap.php is under
your account home and that the domain's index.php is at its document root.
If you see a database error, check the full cPanel names, password, PHP
extensions, and whether the SQL import finished in the selected database.
