MCPSERV.CLUB
Elgg

Elgg

Self-Hosted

Open source social networking engine for custom communities

Active(100)
1.7kstars
0views
Updated 7 days ago

Overview

Discover what makes Elgg powerful

Elgg is a **PHP‑based, modular framework** designed to bootstrap social networking and collaboration applications. At its core it exposes a rich API surface that lets developers create new entity types, extend the UI with themes and plugins, and hook into a powerful event system. The architecture is intentionally lightweight yet extensible: the core bundle is roughly 70 % of a typical Symfony‑style application, with dependency injection, an HTTP foundation, and a service registry that allows third‑party code to plug in without modifying the core.

Event & View Hooks

Entity System

Service‑Based Architecture

RPC & Ajax

Overview

Elgg is a PHP‑based, modular framework designed to bootstrap social networking and collaboration applications. At its core it exposes a rich API surface that lets developers create new entity types, extend the UI with themes and plugins, and hook into a powerful event system. The architecture is intentionally lightweight yet extensible: the core bundle is roughly 70 % of a typical Symfony‑style application, with dependency injection, an HTTP foundation, and a service registry that allows third‑party code to plug in without modifying the core.

Key Features

  • Event & View Hooks – Every major action (entity save, view rendering, access check) fires an event that plugins can listen to or cancel. Views are compiled from Twig‑like templates, enabling theme authors to override or augment the presentation layer.
  • Entity System – Entities are PHP objects backed by a relational database via Doctrine‑DBAL. A single elgg_entity table stores common fields, while subclass tables (e.g., user, group) hold type‑specific data. This pattern gives developers a unified API (elgg_get_entity, elgg_create_entity) while still allowing custom entity classes.
  • Service‑Based Architecture – Core services (cache, mail, routing) are registered in a Symfony container. Plugins can declare dependencies on these services or register their own, making dependency injection first‑class.
  • RPC & Ajax – A lightweight JSON‑P RPC layer exposes endpoints (elgg.service) for mobile or SPA clients. Client‑side code is bundled as ES modules and consumes these services via the built‑in elgg.api JavaScript library.

Technical Stack

LayerTechnology
Web ServerApache or NGINX (mod_php / PHP‑FPM)
LanguagePHP 8.1+
Framework CoreSymfony2 HTTP Foundation, Doctrine‑DBAL
MailLaminas Mail
XSS ProtectionhtmLawed
Database MigrationsPhinx
Asset PipelineCSS‑Crush, ES modules (Babel)
Image ManipulationImagine
CachingMemcached / Redis via Doctrine Cache
LoggingMonolog

The stack is intentionally lean: Elgg ships with a minimal set of vendor libraries, allowing developers to swap out components (e.g., replace Redis with APCu) by overriding services in the DI container.

Deployment & Infrastructure

Elgg is a classic LAMP/LEMP stack application. It requires:

  • PHP ≥ 8.1 with extensions (pdo, mbstring, gd/imagick)
  • A relational database (MySQL, MariaDB, PostgreSQL)
  • Optional caching backend (Memcached or Redis)

For production, it is recommended to serve static assets (CSS, JS, images) from a CDN or separate origin, leveraging Elgg’s cacheable static asset system. Docker images are available in the community repository, and a docker-compose.yml can spin up a ready‑to‑run stack with MySQL, Redis, and PHP‑FPM. Horizontal scaling is supported via stateless application instances; the only stateful components are the database and cache, both of which can be clustered.

Integration & Extensibility

Elgg’s plugin system is the primary extension point. A plugin declares metadata (elgg-plugin.php) and can:

  • Register new entity types, forms, and views
  • Add routes (elgg_register_plugin_hook_handler('route', ...))
  • Define custom access controls (elgg_register_action) and permissions
  • Expose REST endpoints via the RPC service

Webhooks are supported through the notifications API, allowing third‑party services to subscribe to events such as entity:created. Additionally, the framework exposes a public PHP API that can be consumed by external services, making it straightforward to integrate with OAuth providers, SAML IdPs, or custom authentication backends.

Developer Experience

  • Documentation – The official docs (learn.elgg.org) cover core APIs, plugin development, and theme authoring. A dedicated API reference is generated from PHPDoc annotations.
  • Community & Ecosystem – Over 1,000 open‑source plugins exist on the Elgg Marketplace, covering analytics, social login, and custom widgets. The foundation hosts a GitHub organization where issues and pull requests are actively managed.
  • Testing – Continuous integration with PHPUnit, code coverage via Scrutinizer, and quality gates ensure that plugins adhere to a high standard.

Use Cases

  1. Campus Social Network – Universities can deploy Elgg to provide course groups, event calendars, and document sharing without building from scratch.
  2. Enterprise Intranet – Companies use Elgg to create private collaboration spaces, with granular access controls and LDAP integration.
  3. Brand Community – Brands build consumer forums and support portals, leveraging Elgg’s notification system to keep users engaged.
  4. Developer‑Owned Apps – Startups can prototype social features (following, activity feeds) rapidly while maintaining full control over the stack.

Advantages

  • Open Source & GPL‑licensed – No licensing costs and full source visibility.
  • Rapid Development – The core API abstracts common social patterns (entities, access, notifications), reducing boilerplate.
  • Extensibility – The event/view hook system and DI container make adding new features painless.
  • Performance – Caching layers, stateless request handling, and a lightweight core keep memory footprints low.
  • Community Support – A dedicated foundation ensures long‑term maintenance, security patches, and a vibrant plugin ecosystem.

In summary,

Open SourceReady to get started?

Join the community and start self-hosting Elgg today