# Introduction 
TODO: Give a short introduction of your project. Let this section explain the objectives or the motivation behind this project. 

# Getting Started
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
1.	Installation process
2.	Software dependencies
3.	Latest releases
4.	API references

# Build and Test
TODO: Describe and show how to build your code and run the tests. 

# Contribute
TODO: Explain how other users and developers can contribute to make your code better. 

If you want to learn more about creating good readme files then refer the following [guidelines](https://docs.microsoft.com/en-us/azure/devops/repos/git/create-a-readme?view=azure-devops). You can also seek inspiration from the below readme files:
- [ASP.NET Core](https://github.com/aspnet/Home)
- [Visual Studio Code](https://github.com/Microsoft/vscode)
- [Chakra Core](https://github.com/Microsoft/ChakraCore)


# Prerequisites

Before setting up the project, ensure the following are installed:

- PHP 8.x or above
- Composer
- Web Server (Apache/Nginx)
---

# Project Setup

## 1. Clone the Repository

```bash
git clone <repository-url>
cd <project-folder>
```

---

## 2. Install Frontend Dependencies

From the project root directory, run:

```bash
composer install
```

---

## 3. Install Backend Dependencies

Navigate to the `api` directory and install backend dependencies:

```bash
cd api

composer install
```

---

## 4. Configure Environment Variables

Navigate to the `env` folder.

Locate the `.env` file and update the required configuration values according to your environment.

Typical values include:

- BASE_URL
- API_BASE_URL
- PORTAL_API_BASE_URL
- ROOT_DIR
- PORTAL_CODE
- DOMAIN
- PORTAL_API_DOMAIN
- ROOT_DIR

Example:

```env
PHALCON="5.9.0"
VERSION="1.0.0"
APP_ENV=""
PORTAL_CODE="technavio"
CORE_DOMAIN = ""
DOMAIN=""
BASE_URL=""
API_BASE_URL="/api/data-insights/services"
PORTAL_API_BASE_URL="/api/portal-insights/services"
PORTAL_API_DOMAIN="/api/portal-insights/services"
ROOT_DIR="/var/www/html//"
STREAMING_API_URL=""

# Piwik Pro
IS_PIWIK_ENABLED="FALSE"
PIWIK_ENABLED=1
PIWIK_URL=""
PIWIK_ID=""

#PIWIK SETTINGS
ADDPIWIK = "FALSE"
PIWIK_ENABLED=1

#HUBSPOT SETTINGS
HUBSPOT_EMBED = "FALSE"
HUBSPOT_CODE = ""

```

> **Note:** Ensure all mandatory values are configured before running the application.

---
## 5. Update Database configurations
Open the following configuration file: 

```
api/_configs/db.config.php
```
copy the db.config.php from old folder to new folder

Example:

```php
<?php
/**
* PostgreSQL Database Config
* @var host (string)
* @var username (string)
* @var password (string)
* @var dbname (string); Database Name
*/
$DBCONFIG = array(
	'host'        => '',
    'username'    => '',
    'password'    => '',
    'dbname'      => '',
    'schema'      => ''
);

```

## 6. Update External API's 

Open the following configuration file: 

```
api/_configs/1.0/data.api.config.php
```

copy the data.api.config.php from old folder to new folder

Example:

```php
<?php
 
/** *************************************************************************
 * External Data API (External Lambda API)*
 ** **************************************************************************/
 
/**
 * BizVibe Data APIs (External Lambda API) Information
 * @author System Generated
 * @created on 18-06-2024 09:43:59am
 *
 * @var apiEndpoint (string) - API Endpopint
 * @var authHeader (string)
 * @var authKey (string)*
 *
 */
return array(
    'apiList' => array(
        'search' => array(
            'api' => '/Search',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'advanceSearch' => array(
            'api' => '/advancedSearch',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'smartSearch' => array(
            'api' => '/smartSearch',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'aioverview' => array(
            'api' => '/ai_overview',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'vendorsListDetails' => array(
            'api' => '/getVendorList',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'getPdfFullReportByPage' => array(
            'api' => '/get-pdf',
            'method' => 'POST',
            'environment' => 'DEMO'
        ),
        'dispatchPDF' => array(
            'api' => '/dispatchPDF',
            'method' => 'POST',
            'environment' => 'MOCK'
        ),
        'getReportBasicDetails' => array(
            'api' => '/getReportBasicDetails',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'executiveSummary' => array (
            'api' => '/executiveSummary',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'marketDefinition' => array (
            'api' => '/marketDefinition',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'marketSize' => array (
            'api' => '/marketSize',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'geographic' => array (
            'api' => '/geographic',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'segmentation' => array (
            'api' => '/segmentation',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'trends' => array (
            'api' => '/trends',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'fiveForces' => array (
            'api' => '/fiveForces',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'customer' => array (
            'api' => '/customer',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'vendorLandscape' => array (
            'api' => '/vendorLandscape',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'vendorsCovered' => array (
            'api' => '/vendorsCovered',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'vendorsSwot' => array (
            'api' => '/vendorsSwot',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'thematic' => array (
            'api' => '/thematic',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'methodology' => array (
            'api' => '/methodology',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        ),
        'globalReport' => array (
            'api' => '/globalReport',
            'method' => 'POST',
            'environment' => 'MOCK'
        ),
        'fetchReport' => array (
            'api' => '/fetchReport',
            'method' => 'POST',
            'environment' => 'MOCK'
        ),
        'getUpcomingReports' => array(
            'api' => '/getUpcomingReports',
            'method' => 'POST',
            'environment' => 'MOCK'
        ),
        'riaAskAi' => array(
            'api' => '/TN_askAI',
            'method' => 'POST',
            'environment' => 'PRELIVE'
        )
    ),
    'environments' => array(
        'MOCK' => array(
            'apiEndPoint' => '',
            'apiPath' => '',
            'apiSecurityOn' => false,
            'apiAuthHeader' => '',
            'apiAuthType' => '',
            'apiAuthToken' => ''
        ),
        'PRELIVE' => array(
            'apiEndPoint' => '',
            'apiPath' => '',
            'apiSecurityOn' => false,
            'apiAuthHeader' => '',
            'apiAuthType' => '',
            'apiAuthToken' => ''
        ),
        'DEMO' => array(
            'apiEndPoint' => '',
            'apiPath' => '',
            'apiSecurityOn' => false,
            'apiAuthHeader' => '',
            'apiAuthType' => '',
            'apiAuthToken' => ''
        ),
        'LIVE' => array(
            'apiEndPoint' => '',
            'apiPath' => '',
            'apiSecurityOn' => true,
            'apiAuthHeader' => 'Authorization',
            'apiAuthType' => 'Bearer',
            'apiAuthToken' => ''
        )
    )
);



```
Replace the URL with the appropriate endpoint for your environment.

copy the 
```
api/_configs/1.0/plans.config.json
```

If not created please copy from the pages/plans.config.json
```json
{
  "technavio": {
    "portal_name": "technavio",
    "plans": [
      {
        "plan_name": "Pro",
        "plan_code": "PRO",
        "view_count": -1,
        "view_period": "",
        "reports_count": 0,
        "reports_period": "",
        "quota_mode": "period",
        "dashboard_count": "",
        "dashboard_period": "",
        "dashboard_label": "",
        "status": "A"
      },
      {
        "plan_name": "Pro Max",
        "plan_code": "PROMAX",
        "view_count": -1,
        "view_period": "",
        "reports_count": 12,
        "reports_period": "Year",
        "quota_mode": "period",
        "dashboard_count": "",
        "dashboard_period": "",
        "dashboard_label": "",
        "status": "A"
      },
      {
        "plan_name": "Business",
        "plan_code": "BUSINESS",
        "view_count": -1,
        "view_period": "",
        "reports_count": 60,
        "reports_period": "Year",
        "quota_mode": "period",
        "dashboard_count": "",
        "dashboard_period": "",
        "dashboard_label": "",
        "status": "A"
      },
      {
        "plan_name": "Enterprise",
        "plan_code": "ENTERPRISE",
        "view_count": -1,
        "view_period": "",
        "reports_count": -1,
        "reports_period": "",
        "quota_mode": "unlimited",
        "dashboard_count": "",
        "dashboard_period": "",
        "dashboard_label": "",
        "status": "A"
      }
    ]
  }
}

```

## 7. Update the index.php 

```
<?php
 header('Location: /home') need to change to callback.php
```

> **Note:** Ensure all mandatory values are configured before running the application.

## 8. Update or add .htaccess files

```
RewriteEngine On

RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[\s?] [NC]
RewriteCond %1 !^(index|callback|404|401|access-denied)$ [NC]
RewriteCond %1 !^[A-Za-z]: [NC]
RewriteRule ^ %1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule (^|/)\. - [F]
RewriteRule ^\.env - [F]
RewriteRule ^app/ - [F]

RewriteRule ^callback(?:\.php)?$ callback.php [L,NC]
RewriteRule ^ index.php [L]

```

# Running the Application

Configure your web server to point to the project root.

Once configured:

- Access the frontend using your configured domain or localhost URL.
- Ensure the backend API is accessible.
- Confirm Stripe configuration is correct before testing subscription payments.

---

# Support

For any setup issues or configuration assistance, contact the project development team.