RESMİ DOKÜMANTASYON • v4.2.2 • MIT

PurifyCMS Geliştirici & Kurulum Rehberi

Veritabanısız (flat-file JSON), PurifyVolt önbellekli ve entegre e-ticaret motorlu PurifyCMS v4.2.2 için tek kaynaklı teknik dokümantasyon.

1. Genel Bakış & Sistem Gereksinimleri

PurifyCMS, MySQL veya herhangi bir SQL veritabanına ihtiyaç duymadan çalışan hafif bir PHP içerik yönetim sistemi ve e-ticaret motorudur. Tüm veriler atomik JSON dosyalarında saklanır; APCu ve statik HTML önbellekleme (PurifyVolt) ile yüksek performans sunar.

Gereksinimler

  • PHP Sürümü: PHP 8.1+ (PHP 8.2+ önerilir)
  • Web Sunucusu: Apache (mod_rewrite aktif) veya Nginx
  • Zorunlu Eklentiler: json, session, curl, mbstring, zip
  • Önerilen Eklentiler: apcu (RAM önbelleği), gd veya imagick (otomatik WebP dönüşümü)

2. Kurulum Yöntemleri

Yöntem A — Docker / Docker Compose & Coolify (En Hızlı)

Depoyu klonlayın ve konteyneri başlatın. Coolify kullanıyorsanız depoyu doğrudan Dockerfile ile bağlayıp iç portu 80 olarak belirleyebilirsiniz.

bash (Docker)
git clone https://github.com/paimontwo/PurifyCMS.git
cd PurifyCMS
docker compose up -d
# http://localhost:8080

Yöntem B — Web Kurulum Sihirbazı (Paylaşımlı Hosting / VDS)

Dosyaları web kök dizinine aktarın, inc/ ve tmp/ klasörlerine yazma izni verin ve tarayıcıdan alan adınızı açarak sihirbazı tamamlayın.

bash (Hosting / VDS)
git clone https://github.com/paimontwo/PurifyCMS.git .
chmod -R 775 inc/ tmp/

Yöntem C — Manuel Yapılandırma

inc/config.sample.php dosyasını inc/config.php olarak kopyalayıp alan adı, yönetici yolu ve parolanızı düzenleyin (varsayılan yönetici yolu: /admin).

bash (Manual)
cp inc/config.sample.php inc/config.php

3. Nginx & Apache Sunucu Yapılandırması

Apache kullanıcıları için kök dizindeki .htaccess dosyası otomatik çalışır. Nginx üzerinde ise hassas klasörleri (inc/, admin_core/, themessrc/), block raw .json/.log access, and route pretty URLs to index.php:

nginx.conf
server {
    listen 80;
    server_name yourdomain.com;
    root /var/www/html/purifycms;
    index index.php;

    # Block direct access to core & internal theme source folders
    location ~* ^/(inc|admin_core|themes/[^/]+/src)/ {
        deny all;
        return 403;
    }

    # Block sensitive data & log extensions
    location ~* \.(sqlite|log|ini|json|md|dat|tmp)$ {
        deny all;
        return 403;
    }

    # Pretty URL routing
    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|webp)$ {
        expires 30d;
        add_header Cache-Control "public, no-transform";
    }
}

4. Directory & Core Architecture

PurifyCMS cleanly separates core engine code, flat-file JSON data, payment gateways, and theme templates:

PurifyCMS v4.2.2 Tree
PurifyCMS/
├── index.php                  # Front controller & router
├── install.php                # Web installation wizard
├── Dockerfile & docker-compose.yml
├── admin_core/                # Admin dashboard (pages, products, orders, themes, security, health)
├── api/
│   ├── contact.php            # Contact form endpoint
│   └── ecommerce/             # checkout.php, callback.php, download.php, order-lookup.php
├── inc/
│   ├── config.php             # Site & eCommerce configuration
│   ├── kernel.php             # PurifyVolt cache engine, i18n (p_lang), bootstrap
│   ├── security.php           # CSRF, brute-force protection, hardened sessions
│   ├── PurifyTrade.php        # Flat-file eCommerce engine
│   ├── PurifyMailer.php       # SMTP & email templates
│   ├── gateways/              # BaseGateway.php (abstract) & PayTR.php
│   └── data/                  # Atomic JSON storage (cache/, ecommerce/, locales/, logs/, stats/)
└── themes/
    └── purifydefault/         # theme.json, src/ (layout, head, navbar, footer), pages/, assets/

5. Configuration Reference (inc/config.php)

Core system settings live in inc/config.php. Key configuration variables:

Variable Default Description
$cfg_mainurl http://localhost Primary site URL including protocol.
$cfg_admin_path admin Custom admin panel route slug (e.g. panel-94).
$cfg_admin_ips "" (any) Comma-separated IP allowlist for admin login.
$cfg_trust_proxies false Set to true when running behind Cloudflare or a reverse proxy.
$cfg_active_theme purifydefault Active theme folder name under themes/.
$cfg_readonly_mode false Temporarily locks file writes across the CMS.
$cfg_maintenance_mode false Serves src/maintenance.php to non-admin visitors.
$cfg_enable_ecommerce true Enables or disables the Purify Commerce engine.
$cfg_paytr_m_id / key / salt "" Merchant credentials for the built-in PayTR gateway.

6. Theme Development & Visual Editor Zones

themes/purifydefault is the system reference theme and may be overwritten on updates. Duplicate it under a new folder name and update theme.json for custom projects. Pages are rendered inside src/layout.php via $page_content, and visual-editor blocks are marked with Purify zone comments:

themes/mytheme/pages/about.php
<?php
$title = p_lang('about_title', 'About Us');
$desc  = p_lang('about_desc', 'Learn more about our company.');
?>

<!-- purify:zone:about_hero_start -->
<section class="hero">
    <h1><?= htmlspecialchars($cfg_name ?? 'PurifyCMS') ?></h1>
    <p><?= p_lang('about_intro', 'Fast, flat-file publishing.') ?></p>
</section>
<!-- purify:zone:about_hero_end -->

7. PurifyVolt Caching & Multi-Language (i18n)

PurifyVolt combines in-memory APCu with pre-rendered Static HTML files in inc/data/cache/. Saving content or settings automatically triggers PurifyVolt::flushHtml(). Translations are loaded dynamically from JSON dictionaries in inc/data/locales/ using p_lang('key', 'Default').

8. Purify Commerce & Payment Gateways

The built-in eCommerce engine (inc/PurifyTrade.php) handles physical & digital products, checkout, callbacks, order lookup, and protected downloads via api/ecommerce/. PayTR (inc/gateways/PayTR.php) and Bank Transfer are bundled. To add a custom payment provider, extend PurifyPaymentGateway from inc/gateways/BaseGateway.php:

inc/gateways/CustomGateway.php
<?php
require_once __DIR__ . '/BaseGateway.php';

class CustomGateway extends PurifyPaymentGateway {
    public function getToken($order_id, $amount, $customer, $items) {
        // Initialize payment session and return token/redirect payload
        return ['status' => 'success', 'redirect_url' => '...'];
    }

    public function verifyCallback($post_data) {
        // Verify HMAC / webhook signature from payment provider
        return true;
    }
}

9. Security, Backups & Release Notes

  • Hardened Security (inc/security.php): Built-in CSRF tokens, brute-force mitigation, hardened sessions, optional CAPTCHA, custom $cfg_admin_path, and IP allowlisting.
  • One-Click ZIP Backup: Export complete site data, themes, and orders as a single ZIP archive directly from the admin panel.
  • v4.2.2 (Latest — Nov 30, 2026): PurifyCMS & Commerce released as 100% Open Source under the MIT License on GitHub, featuring Docker/Coolify support, PurifyVolt caching, and the Commerce v4 engine.