# Installation and Update

### Code Snippets addon **[WHMCS](https://puqcloud.com/link.php?id=77)**
#####  [Order now](https://puqcloud.com/store/whmcs-addon-modules) | [Download](https://download.puqcloud.com/WHMCS/addons/PUQ_WHMCS-Code-Snippets/) | [FAQ](https://community.puqcloud.com/)

## System Requirements

| Requirement | Minimum |
|-------------|---------|
| **PHP** | 8.1, 8.2 or newer |
| **WHMCS** | 8.x, 9.x or newer |
| **ionCube Loader** | v13 or newer (v14, v15) |

> **Note:** The module uses ionCube encoding. Make sure ionCube Loader is installed and active on your server.

---

## Download

The module can be ordered and downloaded from PUQ Cloud:

- **Order / Download:** [https://puqcloud.com/store/whmcs-addon-modules](https://puqcloud.com/store/whmcs-addon-modules)
- **FAQ:** [https://community.puqcloud.com/](https://community.puqcloud.com/)
- **Direct download links:**

PHP 8.1:
```
wget https://download.puqcloud.com/WHMCS/addons/PUQ_WHMCS-Code-Snippets/php81/PUQ_WHMCS-Code-Snippets-latest.zip
```

PHP 8.2+:
```
wget https://download.puqcloud.com/WHMCS/addons/PUQ_WHMCS-Code-Snippets/php82/PUQ_WHMCS-Code-Snippets-latest.zip
```

> All versions are available at: [https://download.puqcloud.com/WHMCS/addons/PUQ_WHMCS-Code-Snippets/](https://download.puqcloud.com/WHMCS/addons/PUQ_WHMCS-Code-Snippets/)

After downloading, extract the archive:

```
unzip PUQ_WHMCS-Code-Snippets-latest.zip
```

---

## Installation

### Step 1: Upload Files

Extract the module archive and upload the `puq_code_snippets` directory to the WHMCS addons directory:

```
/your-whmcs/modules/addons/puq_code_snippets/
```

Directory structure after upload:

```
modules/addons/puq_code_snippets/
    puq_code_snippets.php
    hooks.php
    whmcs.json
    version
    logo.png
    lib/
        puqCodeSnippets.php
    lang/
        english.php
    templates/
        ...
```

### Step 2: Activate the Module

1. Log in to the WHMCS admin panel
2. Go to **Setup** > **Addon Modules**
3. Find **PUQ Code Snippets** in the list
4. Click **Activate**

> On activation, the module creates three database tables: `puq_code_snippets`, `puq_code_snippets_settings`, and `puq_code_snippets_history`.

### Step 3: Configure the License Key

1. After activation, click **Configure** next to the module
2. Enter your license key in the **License key** field
3. Select admin role groups that should have access to the module
4. Click **Save Changes**

After saving, a verification status will appear below the license key field (e.g., `success: 2027-02-16T21:32:28+01:00`).

![Module configuration with license key and access control](https://doc.puq.info/uploads/images/gallery/2026-02/embedded-image-6zf1rbru.png)
*01-addon-config-license.png*

### Step 4: Access the Module

Go to **Addons** > **PUQ Code Snippets** to access the dashboard.

---

## Update

### Step 1: Backup

Before updating, we recommend backing up:
- Your WHMCS database
- Module files in `modules/addons/puq_code_snippets/`

> **Tip:** Use the Export feature in Settings to save all your snippets before updating.

### Step 2: Upload New Files

Extract the new version and overwrite all files in:

```
/your-whmcs/modules/addons/puq_code_snippets/
```

### Step 3: Re-activate (if needed)

If the update adds new database columns, deactivate and re-activate the module:

1. Go to **Setup** > **Addon Modules**
2. Click **Deactivate**, then **Activate** again

> This is safe — the module only creates tables/columns if they don't already exist. Your snippets and settings are preserved.

### Step 4: Verify

1. Go to **Addons** > **PUQ Code Snippets**
2. Check the version number in the top-right corner of the navigation bar (e.g., `v1.0`)

---

## Deactivation

1. Go to **Setup** > **Addon Modules**
2. Click **Deactivate** next to PUQ Code Snippets
3. Confirm the deactivation

> **Warning:** Deactivation drops the module's database tables (`puq_code_snippets`, `puq_code_snippets_settings`, `puq_code_snippets_history`). All your snippets, settings, and history will be lost. Export your snippets before deactivating if you want to preserve them.

---

## License

The module requires an active license for full functionality. The license is verified through the PUQ Cloud license server.

### How License Verification Works

- The module periodically checks license validity at `https://license.puqcloud.com/`
- Verification results are cached in the database for 5 days
- If the license server is temporarily unreachable, the module uses the last cached result

### Without an Active License

- **Dashboard** (Home page) remains fully accessible
- **All other pages** (Snippets, History, Settings) display a license required page
- **All AJAX controllers** (except Dashboard data) return a 403 error
- **Snippets continue to render** on the frontend — they are not disabled without a license

### After Activating a License

1. The warning banner disappears
2. All pages and features become accessible
3. Enter your license key in **Setup** > **Addon Modules** > **PUQ Code Snippets** > **Configure**

### Purchase a License

**[https://puqcloud.com/store/whmcs-addon-modules](https://puqcloud.com/store/whmcs-addon-modules)**

For license-related questions, please contact us via the ticket system:

**[https://puqcloud.com/submitticket.php](https://puqcloud.com/submitticket.php?step=2&deptid=1)**


<!-- sync:afd5333fa4859b31 -->