HomePortfolioExtensionsScriptsAbout
PHP script

Logos

Self-hosted vector logo directory and sharing platform. Multi-format SVG/PNG downloads, color extraction, dark variants, WordPress WXR import, and an intuitive admin panel.

This comprehensive guide details installing, configuring, and operating Logos, a self-hosted PHP 8.2+ vector logo directory platform. Use it during initial server deployment and as an ongoing reference for managing logo assets, collections, and security.

Tip

Logos is built with plain PHP and zero Composer dependencies. After completing the browser setup at /setup.php, always delete both setup.php and the install/ directory from your server.

Overview

Logos empowers designers, brand agencies, marketing teams, and curators to run a dedicated vector logo catalog on their own infrastructure. You can explore a live production demo at latestlogo.com. Public visitors can easily search, explore collections, copy raw SVG vectors, grab color hex codes, and download clean SVGs or high-resolution PNGs.

  • Public experience: Fast search, collections index, tag filtering, random logo generator, SVG/PNG variant downloads (standard, dark background, white monochrome), one-click SVG clipboard copying, and color palette swatches.
  • Admin control: WordPress-inspired dashboard with dark mode, full logo and media management, collections, tags, static pages, and database utilities.
  • Authentication options: Email and password, one-time passcode (OTP) email login, and Google OAuth 2.0.
  • Spam & bot protection: Built-in support for Google reCAPTCHA v2 and Cloudflare Turnstile.
  • Data portability: WordPress WXR XML import and export tools with automated local asset downloading.
  • Performance: Lightweight execution with native PHP, disk-based page caching, and instant preloading for instant page switches.

Directory structure

  • app/ - Application core, MVC controllers, models, and public/admin view templates.
  • bin/ - CLI utilities such as create-admin.php, backup-drive.php, and import-xml.php.
  • config/ - Configuration files for routes, database connections, and application settings.
  • database/ - Database schema definitions (schema.sql) and migration templates.
  • deploy/ - Server deployment recipes, including nginx.example.conf.
  • install/ - Browser-based installation wizard and asset checks.
  • public/ - Web entry point, public static assets (CSS, JS, WebFonts), and sitemap XSL styles.
  • storage/ - Uploaded logo assets, media items, logs, imports, page cache, and backups.
  • .htaccess - Root Apache rewrite rules that protect system directories and route public URLs without requiring virtual host tweaks.

Requirements

  • PHP version: PHP 8.2 or newer.
  • PHP extensions: pdo_mysql, mbstring, fileinfo, openssl, dom, and xml.
  • Database: MySQL 8.0+ or MariaDB 10.5+.
  • Web server: Apache with mod_rewrite enabled, or Nginx with PHP-FPM.
  • File permissions: The storage/ folder and all its subdirectories must be writable by the web server user (e.g. chmod -R 775 storage).
  • HTTPS: An active SSL certificate is required for public installations to safeguard admin sessions, OAuth redirects, and API tokens.

Install & setup

Method 1: Browser-based visual installer (Recommended)

  1. Upload files: Upload the complete script archive to your web root (or any desired subfolder, e.g. /logos/) via SFTP, rsync, or your hosting control panel.
  2. Configure permissions: Verify that the storage/ directory is writable by your web server:
    chmod -R 775 storage
  3. Create database: Create an empty database in MySQL or MariaDB with utf8mb4_unicode_ci encoding:
    CREATE DATABASE logo_directory CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  4. Launch setup: Navigate to https://yourdomain.com/setup.php in your web browser. The visual installer validates PHP extensions, writes your .env file, imports the database schema, and guides you through creating your initial Administrator account.
  5. Security cleanup: Once setup completes successfully, delete both setup.php and the install/ folder:
    rm -rf setup.php install/
  6. Sign in: Open https://yourdomain.com/admin/login to access your dashboard.

Method 2: CLI / Terminal installation

For automated VPS provisioning or headless staging servers, configure the application directly from the shell:

# 1. Create database and load schema
mysql -u root -p -e "CREATE DATABASE logo_directory CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -p logo_directory < database/schema.sql

# 2. Copy and configure environment variables
cp .env.example .env
nano .env

# 3. Provision the primary Administrator account
php bin/create-admin.php "Super Admin" [email protected] "YourStrongPasswordHere"

Local testing server

To run and test Logos locally using PHP's built-in development server:

php -S localhost:8080 router.php

Then open http://localhost:8080/setup.php in your browser.

Environment (.env)

System settings, credentials, and API secrets are stored securely in .env at your project root:

VariableDefaultDescription
APP_URLhttps://yourdomain.comPublic site URL without trailing slash.
DB_HOSTlocalhostMySQL database server host.
DB_NAMElogo_directoryDatabase name.
DB_USERrootDatabase username.
DB_PASS-Database user password.
CAPTCHA_MODEnoneVerification provider: none, recaptcha, turnstile, or both.
GOOGLE_CLIENT_ID-Google OAuth 2.0 Web Application Client ID for admin sign-in.
GOOGLE_CLIENT_SECRET-Google OAuth Client Secret.
RECAPTCHA_SITE_KEY-Google reCAPTCHA v2 site key.
RECAPTCHA_SECRET_KEY-Google reCAPTCHA v2 secret key.
TURNSTILE_SITE_KEY-Cloudflare Turnstile site key.
TURNSTILE_SECRET_KEY-Cloudflare Turnstile secret key.
SMTP_HOST-SMTP outgoing mail host for OTP emails.
SMTP_PORT587SMTP port (usually 587 for TLS or 465 for SSL).
FEED_ITEMS10Number of latest logos served in the RSS 2.0 feed.
SITEMAP_PER_FILE1000Maximum logo URLs per generated sitemap partition.

Public site features

Clean URLs

  • / - Homepage with branded hero search and latest logos grid.
  • /latest - Chronological listing of all uploaded logos with pagination.
  • /random - Discovers and opens a random logo from your catalog.
  • /collections/{slug} - Brand logos categorized within a specific collection.
  • /tag/{slug} - Brand logos filtered by an assigned tag.
  • /logos/{slug}/ - Dedicated logo detail and download page.
  • /{slug} - Static information pages (e.g. Terms, Privacy, About).

Logo detail & download interface

Each logo detail page at /logos/{slug}/ provides an intuitive, distraction-free toolkit for developers and graphic designers:

  • Vector and raster downloads: Download pristine SVGs or crisp PNGs with automatic format detection.
  • Theme variants: Switch between default brand colors, dark background variants, and white monochrome files.
  • Copy SVG code: One-click button copies raw sanitized SVG markup directly to the system clipboard for immediate pasting into Figma, Sketch, or HTML templates.
  • Extracted color palette: Displays identified hex swatches extracted from the SVG vector. Clicking any swatch copies the hex code instantly.
  • Brand metadata: Links to the official company domain, assigned collections, tags, and copyright disclaimers.

Instant preloading

Logos ships with instant-preload.js, an intelligent prefetching engine that warms public pages when visitors hover over links, achieving near-instantaneous page transitions without heavy client-side frameworks.

Admin dashboard

Sign in at https://yourdomain.com/admin/login to reach the WordPress-inspired administration suite.

  • Flexible login methods:
    • Username / Email and password.
    • Email OTP (one-time passcode delivered via configured SMTP).
    • Google OAuth 2.0 (one-click sign-in matching registered admin accounts).
  • Brute-force mitigation: All authentication routes are monitored by a rate limiter and failed login tracker. Repeated failed attempts trigger timed IP lockouts.
  • Role-based access: Create Administrator and Editor roles. Admins enjoy complete access to database and system settings, while Editors manage logo content and collections.

Logos & media

Adding and editing logos

Navigate to Admin → Logos → Add New:

  • Title & slug: Set the brand title. Slugs are automatically generated and can be customized.
  • Primary files: Upload the primary color SVG and optional primary PNG.
  • Theme variants: Optionally upload dark-mode SVGs/PNGs (for dark backgrounds) and white monochrome files.
  • Color palette: Auto-extracted from uploaded SVGs, or manually refined using hex values.
  • Taxonomy: Categorize into Collections and assign descriptive tags.
  • Publishing workflow: Save as Draft or Publish immediately.

Automatic SVG sanitization

Security Note

Unchecked SVG files can contain malicious JavaScript (XSS). Logos inspects every uploaded vector through its built-in SvgSanitizer service, automatically stripping <script> tags, inline event attributes (e.g. onload, onerror), CSS expression strings, and external entity injections.

Media library

The Media view (/admin/media) catalogs all vector assets and rendered PNGs, displaying file dimensions, mime types, file sizes, and creation timestamps.

Collections & pages

  • Collections (/admin/categories): Group logos by industry (e.g., Tech, Finance, Social, E-Commerce). Each collection features a custom slug, description, and header display order.
  • Tags (/admin/tags): Organize logos with granular tags for cross-category discovery.
  • Static Pages (/admin/pages): Author and publish custom informational pages such as About Us, Terms of Use, Privacy Policy, and DMCA Guidelines. Pages automatically populate into the public site footer.

WordPress WXR import

Easily migrate logo databases from WordPress sites into Logos without manual re-entry.

  1. Open Admin → Import.
  2. File upload or server path: Upload an exported WordPress WXR file (e.g. .xml), or specify a local server file path for large archives exceeding standard PHP upload limits.
  3. Download media option: Tick "Download SVG/PNG files to local storage" to fetch remote assets onto your server. Leaving this unchecked will maintain existing remote asset URLs.
  4. Execution: The importer parses titles, slugs, categories, tags, dark/white variants, website links, and publish dates seamlessly.

Database & backups

Open Admin → Database to view real-time table diagnostics, row estimates, index sizes, and table overhead.

  • Optimize database: Runs native OPTIMIZE TABLE queries across all application tables to reclaim unused storage and defragment data files.
  • Repair database: Runs REPAIR TABLE to quickly address index corruption.
  • Local SQL exports: Download snapshot backups of your complete MySQL database directly from the admin interface.
  • Google Drive cloud backups: Logos includes bin/backup-drive.php, enabling automated database backups uploaded directly to Google Drive via scheduled cron jobs:
    0 2 * * * php /path/to/logos/bin/backup-drive.php >> /path/to/logos/storage/logs/backup.log 2>&1

Feeds & sitemaps

Logos is engineered for search engine discoverability:

Resource URLFunction
/feedRSS 2.0 XML feed of newest logos, styled with custom XSL (rss-style.xsl).
/sitemap_index.xmlPrimary XML sitemap index linking static and logo partition maps.
/sitemap-static.xmlSitemap index for homepage, collections index, latest, and static pages.
/sitemap-logos-1.xmlPaginated logo sitemap partitions (customizable threshold in .env).
/robots.txtSearch engine directives pointing crawlers to /sitemap_index.xml.

Security architecture

  • Protected storage: Stored logo assets are guarded against unauthorized browsing. Public media is served via the /media/logos/{slug}/{file} streaming pipeline with appropriate MIME and cache headers.
  • Directory lockdown: Internal directories (app/, config/, .env, storage/) are sealed by root Apache rewrite rules and Nginx configuration templates.
  • CSRF mitigation: Every state-changing form in the administrative panel is guarded with cryptographic CSRF tokens.
  • Rate limiting: Authentication endpoints enforce strict rate limiting to prevent brute-force credential stuffing.
  • Zero Composer footprint: Eliminates external supply-chain vulnerabilities by running clean, audited, native PHP.

Troubleshooting

IssueCause & Solution
Setup wizard shows red requirement errorsVerify that PHP 8.2+ is active and that pdo_mysql, mbstring, fileinfo, openssl, dom, and xml extensions are enabled in php.ini.
Database connection failed during setupCheck MySQL server host, database name, and user privileges. Ensure MySQL allows connections from localhost.
Uploaded SVGs fail with validation errorThe uploaded vector file contained forbidden script declarations or malformed XML. Clean the SVG or verify it adheres to valid vector standards.
Internal pages return 404Ensure Apache mod_rewrite is enabled and your virtual host allows AllowOverride All so the root .htaccess can route requests.
Google sign-in shows Redirect URI mismatchEnsure your Google Cloud Console OAuth 2.0 client lists the exact redirect URI: {APP_URL}/admin/login/google/callback.
OTP emails not arrivingVerify your SMTP settings in .env or Admin → Settings. Test outgoing mail connectivity and verify domain SPF/DKIM records.
WXR import times out on large XML filesFor large archives, place the XML file in storage/imports/ and use the Server path option in Admin → Import instead of browser upload.

Need help?

If you encounter any questions regarding deployment, configuration, or custom integrations, check the troubleshooting table above or contact us directly on our support page.