MCPSERV.CLUB
MediaWiki

MediaWiki

Self-Hosted

Collaborative, multilingual knowledge platform

Stale(40)
0stars
0views

Overview

Discover what makes MediaWiki powerful

MediaWiki is a robust, open‑source wiki engine written primarily in PHP that powers Wikipedia and thousands of other knowledge bases. From a developer’s perspective, it is an extensible platform that exposes a rich API surface for programmatic interaction while remaining lightweight enough to run on modest shared‑hosting environments. The core of MediaWiki is a well‑structured MVC‑like architecture where PHP classes handle request routing, database abstraction, and template rendering. It uses a MySQL or MariaDB backend (optionally PostgreSQL) via the `Database.php` abstraction layer, enabling developers to swap storage engines with minimal code changes.

RESTful API

Event Hooks

Template System

Internationalization

Overview

MediaWiki is a robust, open‑source wiki engine written primarily in PHP that powers Wikipedia and thousands of other knowledge bases. From a developer’s perspective, it is an extensible platform that exposes a rich API surface for programmatic interaction while remaining lightweight enough to run on modest shared‑hosting environments. The core of MediaWiki is a well‑structured MVC‑like architecture where PHP classes handle request routing, database abstraction, and template rendering. It uses a MySQL or MariaDB backend (optionally PostgreSQL) via the Database.php abstraction layer, enabling developers to swap storage engines with minimal code changes.

Key Features

  • RESTful API: Exposes endpoints for querying pages, editing content, retrieving revisions, and handling media uploads. The API supports JSON and XML formats, authentication via OAuth or cookie sessions, and can be extended with custom endpoints through the API‑extension framework.
  • Event Hooks: A comprehensive hook system ($wgHooks) allows developers to inject logic at almost any point in the request lifecycle—e.g., before saving a page, after rendering, or during user authentication. Hooks are implemented as PHP callbacks and can be bundled into extensions.
  • Template System: Uses a lightweight Twig‑like syntax ({{ }}) for page templates, enabling developers to create reusable UI components and themes. Themes can be swapped by altering the $wgDefaultSkin variable.
  • Internationalization: Built‑in language packs and message files (.json) make it trivial to localize the UI or add custom messages for extensions.

Technical Stack

LayerTechnology
RuntimePHP 8.x (recommended), Apache/Nginx or FastCGI
DatabaseMySQL 5.7+, MariaDB, PostgreSQL (via extension)
CachingMemcached or Redis for page caching and session storage
SearchBuilt‑in full‑text search, optionally backed by ElasticSearch or Solr
DeploymentDocker images (mediawiki/standalone, mediawiki/apache) and Helm charts for Kubernetes

The core is distributed under the GPL‑2.0-or-later license, allowing unrestricted modification and redistribution.

Core Capabilities

  • Page Revisioning: Every edit creates a new revision with metadata (user, timestamp, comment). Developers can access the full revision history via the API or directly through RevisionStore.
  • Structured Data: The “Semantic MediaWiki” extension adds RDF support, enabling SPARQL queries and graph data integration.
  • User Management: Role‑based permissions ($wgGroupPermissions) and OAuth support for single‑sign‑on scenarios.
  • File Handling: Media uploads are stored on the filesystem or cloud storage; the File API exposes thumbnails, metadata, and MIME type detection.

Deployment & Infrastructure

MediaWiki can be deployed on any LAMP stack, but for production workloads a typical setup includes:

  1. Web Server: Nginx or Apache with PHP‑FPM.
  2. Database Cluster: Read replicas for scaling reads; automatic failover via Galera or Percona XtraDB.
  3. Cache Layer: Redis for session and page caching; Memcached as an alternative.
  4. Search Backend: ElasticSearch or Solr for full‑text indexing; optional for smaller sites.
  5. Containerization: Official Docker images support multi‑stage builds; Kubernetes manifests allow horizontal scaling of stateless web pods while persisting data to a shared volume.

Horizontal scaling is achieved by adding more PHP workers behind the web server and replicating the database. The stateless nature of PHP requests makes it straightforward to add caching layers or CDN front‑ends.

Integration & Extensibility

  • Extensions: Thousands of community extensions exist, ranging from UI tweaks (Vector) to advanced features like VisualEditor. Extensions are installed by dropping a folder into the extensions/ directory and adding an entry to $wgExtensionCredits.
  • API Extensions: Developers can create custom API modules by extending ApiBase, exposing new verbs and parameters.
  • Webhooks: While not native, the EventBus extension allows integration with external services via HTTP callbacks on events such as page creation or deletion.
  • Custom Themes: Skinning is achieved by implementing the Skin interface; developers can create responsive designs or integrate with third‑party CSS frameworks.

Developer Experience

  • Documentation: The official developer portal provides comprehensive guides, API references, and extension authoring tutorials. Inline code comments in the source are abundant.
  • Community: A vibrant mailing list, IRC channel (#mediawiki-dev), and GitHub issue tracker ensure rapid support. Security advisories are published promptly.
  • Configuration: All settings reside in LocalSettings.php; most can be overridden via $wg variables or environment‑specific config files.
  • Testing: MediaWiki ships with PHPUnit tests and a Docker test harness; developers can run phpunit against the core or their extensions.

Use Cases

  • Enterprise Knowledge Bases: Integrate with LDAP for authentication and use Semantic MediaWiki to expose structured data to internal dashboards.
  • Developer Documentation: Pair with VisualEditor and the “API” extension to auto‑generate API docs from code comments.
  • Community Portals: Host localized forums with custom skins and user groups; leverage the event hook system to notify external services on content updates.
  • Education Platforms: Use MediaWiki as a collaborative learning environment, with extensions for quizzes and grading.

Advantages

| Aspect | Why MediaWiki

Open SourceReady to get started?

Join the community and start self-hosting MediaWiki today