Skip to content

CtrlAltDefeat94/siagraph-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SiaGraph Web

This repository contains the PHP code for the SiaGraph website and API.

Requirements

  • PHP 8.2+ (tested on 8.4) with extensions:
    • mysqli (required)
    • ctype, json, tokenizer (required)
    • bcmath (optional; a polyfill is bundled)
  • MySQL server (required)
  • Redis server (optional but recommended for caching)
  • Composer for PHP dependencies
  • Node.js + npm (only if rebuilding CSS)

Notes:

  • If you use PHP-FPM behind Nginx/Apache, ensure the MySQL extension is installed for the PHP version your web server runs (e.g., php8.4-fpm). The CLI can have different modules loaded than FPM.

Configuration

  1. Copy include/config.php.example to include/config.php and edit values:
    cp include/config.php.example include/config.php
    • Set database credentials.
    • Optionally set redis_ip (defaults to 127.0.0.1).
  2. No other files need copying. include/database.php exists for backward compatibility and simply loads bootstrap.php.

Installation and Running

Install PHP dependencies from the repository root:

composer install --no-dev

This generates the vendor/ directory (do not commit it).

Run locally using PHP’s built‑in server:

php -S localhost:8000

Visit http://localhost:8000.

If you see “Class mysqli not found”, install the MySQL extension for your PHP CLI (e.g., Debian/Ubuntu: apt-get install php8.4-mysql).

Building CSS

The SCSS sources live in the scss/ directory. Card styles are defined in scss/components/blocks/_card.scss and the responsive container layout in scss/core/_layout.scss. To regenerate css/style.css install the Node dependencies and run the Mix build:

npm install
npm run prod       # one-time build
# or `npm run dev` to watch during development

Folder Structure

api/       API endpoints (v1) and Swagger definition
css/       Stylesheets
graphs/    PHP classes for graph generation
img/       Images and icons
include/   Shared config and helper files
swagger/   Swagger UI for the API
vendor/    Composer dependencies (generated by Composer; not tracked)

Major pages in the project include:

  • index.php – main network dashboard
  • host_overview.php – host distribution and statistics
  • host_explorer.php – search and view details about a single host
  • network_growth.php – historic growth charts
  • network_storage.php – storage usage and host totals
  • network_aggregates.php – aggregated metrics over time
  • peers.php – map of peers currently online
  • token_volume.php – network volume information
  • tokenomics.php – token supply and economics overview
  • revenue.php – contract revenue and burned funds
  • hosting.php – overview of hosting pages
  • network_overview.php – overview of network pages
  • siafunds_overview.php – overview of Siafunds metrics

Production (Nginx + PHP‑FPM)

Ensure the PHP‑FPM version Nginx uses has mysqli enabled. On Debian/Ubuntu:

apt-get update
apt-get install -y php8.4-fpm php8.4-mysql
systemctl enable --now php8.4-fpm

Example Nginx server block:

server {
    listen 80;
    server_name example.com;
    root /var/www/html/siagraph-web-codex;
    index index.php index.html;

    location / {
        try_files $uri $uri/ @extensionless_php;
    }

    location @extensionless_php {
        rewrite ^/(.*)$ /$1.php last;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/var/run/php/php8.4-fpm.sock; # match your PHP version
    }
}

Avoid defining multiple location ~ \.php$ blocks with different PHP versions; Nginx will use the first regex match which can be confusing.

Verify extensions (CLI vs FPM)

  • CLI: php -m | grep -i mysqli
  • FPM: create /var/www/html/siagraph-web-codex/info.php with <?php phpinfo(); and load it in a browser to confirm mysqli is listed.

Troubleshooting

  • Error: Class "mysqli" not found
    • Install the MySQL extension for the PHP SAPI you’re using:
      • Debian/Ubuntu CLI: apt-get install php8.4-mysql
      • Debian/Ubuntu FPM: apt-get install php8.4-mysql && systemctl restart php8.4-fpm
    • Ensure Nginx points to the same PHP version you installed the module for.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published