Trongate PHP Framework Docs
Introduction
Basic Concepts
Understanding Routing
Intercepting Requests
Module Fundamentals
Database Operations
Templates
Helpers
Form Handling
Working With Files
Image Manipulation
Working With Dates & Times
Authorization & Authentication
Tips And Best Practices

Importing SQL

Trongate Control is a module that makes it easy to import SQL code. Copy a module, visit its URL, and SQL setup happens automatically — no command line or extra tools needed. Trongate Control also checks module versions and framework updates, prompting you when an update is available.


The Problem It Solves

Traditionally, managing features and updates between PHP applications involves:

  • Manual SQL Execution: Setting up databases separately
  • Custom Installers: Writing module-specific scripts
  • Tooling Dependencies: Relying on external package managers
  • Version and Update Management: Ensuring modules and framework are current

Trongate Control automates these tasks while keeping full control in your hands.


How It Works

Manage modules and updates in three simple steps:

  1. Copy the module folder into modules/
  2. Visit the module URL in development mode
  3. Done - SQL files execute automatically, the module is ready, and version checks are performed

Example: Copy a comments/ module from one project to another. Visit /comments once. Tables are created, the module works immediately, and Trongate Control ensures both module and framework are up-to-date.


Step-by-Step Process

Step 1: Copy the Module

Step 2: Visit the URL

Go to: https://localhost/your-app/forums

Step 3: Trongate Control Intercepts

Trongate Control lists available SQL files with three options:

  • VIEW SQL - Preview contents
  • RUN SQL - Execute statements
  • DELETE FILE - Remove without execution

Step 4: Execute SQL

  1. Click RUN SQL
  2. Review the SQL
  3. Confirm execution
  4. The file runs and is deleted automatically

Step 5: Version Check & Completion

After all SQL files are processed, Trongate Control checks the module version and the framework version. If updates are available, it prompts you to install them. Once complete, the module loads normally, and future access will not re-trigger setup.


Safety Features

Development Only

Trongate Control runs only in ENV='dev'. Production is protected automatically.

Suspicious SQL Detection

Files containing potentially dangerous commands trigger warnings:

  • DROP
  • UPDATE
  • TRUNCATE
  • DELETE FROM

File Size Limits

SQL files over 1MB are blocked. Trongate Control is designed for schema and initial data, not bulk imports.

Mandatory Preview

All SQL files must be reviewed before execution. Nothing runs without confirmation.


Child Module Support

Trongate Control detects and processes SQL files in child modules:

Visit: https://yoursite.com/shop-product_reviews

Trongate Control recognises child modules and presents their SQL files automatically.


Custom Routing Compatibility

Trongate Control works with custom routes:

Visiting /admin triggers Trongate Control for trongate_administrators. After SQL execution and version checks, you return to /admin.


Practical Tips

Order SQL Files

Use numbered prefixes for sequential execution:

Keep Modules Self-Contained

Document dependencies in a README.md inside the module folder.

Test First

Run Trongate Control in development first. Confirm functionality and version updates before production deployment.


Core Benefits

  • Zero-Tooling Installation: Copy modules using standard file operations
  • Automatic Database Setup: SQL executes on first access
  • Version Awareness: Trongate Control checks and updates modules and framework automatically
  • Complete Review: Preview all SQL before execution
  • Built-In Safety: Dev-mode only with command detection