Download the PHP package tryhackx/flarum-advanced-pages without Composer

On this page you can find all versions of the php package tryhackx/flarum-advanced-pages. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package flarum-advanced-pages

Advanced Pages for Flarum

Flarum 2.x Packagist

Create advanced custom pages with HTML, BBCode, Markdown, PHP, or plain text content types for your Flarum 2.x forum. A powerful alternative to fof/pages with multi-format support, live preview, formatting toolbars, and granular access control.

Latest highlights (2.1.0):

  • Nested / child pages with a Parent Page selector, drag-and-drop ordering & nesting in the admin (grab the ⋮⋮ handle), parent-chain breadcrumbs, and optional per-tree breadcrumb CSS (style or hide them).
  • Per-content-type creation permissions — control who can create Plain Text / BBCode / Markdown pages from the admin grid, and who can create the sensitive HTML / PHP pages via a dedicated console command (php flarum advancedpages:permission).
  • Per-page "Allow script execution" toggle<script> tags in a page now run only when you explicitly opt in (off by default).
  • Cross-database visibility — per-group visibility now works on SQLite and PostgreSQL too, not just MySQL/MariaDB.
  • $actor now works inside PHP pages.

Note: Advanced Pages targets the 2.x line only (Flarum 2.x).

Features

Screenshots

Mobile view — discussion list rendered with different combinations of TryHackX extensions (thumbnails + ratings + views, thumbnails + views, thumbnails only, ratings only, views only, vanilla Flarum).

Advanced Pages admin panel — page management, BBCode tag toggles ([table], [spoiler], [center], extended [url]), forum spoiler replacement and the Save Changes / Reset Settings row, plus the Manage Advanced Pages and View spoiler content permissions.

Desktop discussion list with the full TryHackX stack — thumbnail sliders on the left, star ratings on the right, magnet button next to each topic.

Desktop discussion list — hover state showing the magnet tooltip loading inline (powered by tryhackx/flarum-magnet-link).

Support Development

If you find this extension useful, consider supporting its development:

You can also find the donation option in the extension's admin settings panel.

Requirements

Installation

Updating

Usage

Creating pages

  1. Go to Admin Panel → Advanced Pages.
  2. Click Create Page.
  3. Choose a content type and write your content.
  4. Configure visibility (published, hidden, restricted, group access).
  5. Save — the page is available at /p/{your-slug}.

Content types

Type Description Security
HTML Full HTML with styles / forms / (opt-in) scripts Rendered raw, NOT sanitised. Creation gated by advancedPages.create.html (console-only). <script> runs only if Allow script execution is enabled per page.
BBCode BBCode with custom tags & toolbar Escaped and parsed via s9e/TextFormatter
Markdown Full Markdown with live preview Escaped and parsed via s9e/TextFormatter
PHP Server-side PHP execution (eval) Full server privileges — not a real sandbox. Creation gated by advancedPages.create.php (console-only). Errors logged, never shown.
Plain Text Auto-escaped text with URL linking Fully escaped output
Redirection Forwards visitors to another URL Target must be an https:///http:// address or a root-relative /path — validated on save, so no javascript:/data: schemes. Creation gated by advancedPages.create.redirect (admin grid).

BBCode toggles

Setting Tags Default
Tables [table] [tr] [th] [td] On
Spoiler [spoiler] [spoiler=Title] On
Center [center] On
Extended URL [url] (accepts URLs Flarum rejects) Off
Replace Forum Spoiler swap Flarum's default [spoiler] for the Advanced Pages details/summary style across all posts Off
Code buttons in posts add the Select / Copy code-block toolbar to regular forum posts (it's always on for Advanced Pages) Off

After toggling BBCode settings, clear the formatter cache:

Newline mode (BBCode)

Per-page newline behaviour:

PHP pages

⚠️ PHP pages run via eval() with full server privileges. The closure only scopes the variables below — it is not a security sandbox. Treat the ability to create PHP pages as equivalent to shell access. By default only administrators can create them.

PHP page code runs in a closure with access to:

PHP errors are written to Flarum's log but never shown to visitors.

Forms, GET, POST and file uploads

PHP pages can read query strings and handle form submissions — including file uploads — through the normal PHP superglobals:

A POST without a valid csrfToken is rejected with HTTP 400 — this is Flarum's standard CSRF protection, not a limitation of the extension. (A live demo page ships at /p/php-request-test.)

Building a nav menu — the $pages tree helper

PHP pages get a read-only $pages helper for walking the page tree, so you can generate a navigation menu, a sidebar, a sitemap, etc. It only ever returns pages the current viewer is allowed to see (drafts, hidden, restricted and per-group pages are filtered out automatically) and is ordered to match the admin tree — so menus never leak hidden pages. The whole visible set is loaded in a single query, no matter how many calls you make.

Method Returns
$pages->all() All visible pages (flat, ordered).
$pages->roots() Top-level pages (no parent).
$pages->children($slug) Direct children of a page (by slug, id or Page).
$pages->tree($slug) Nested ['page' => Page, 'children' => [...]] array — pass a slug (e.g. 'docs') for that subtree, or nothing for the whole forest.
$pages->find($slug) A single page by slug or id (or null).
$pages->ancestors($page) The parent chain (root → immediate parent).

Each Page exposes ->title, ->slug, ->content_type, ->is_published, ->view_count (the hit counter), etc. — so a PHP page can, for example, build a "most viewed pages" list with $pages->all()->sortByDesc('view_count').

Nested pages, ordering & breadcrumbs

Pages form a tree. The hierarchy (parent + order) is the organisation; the slug is the independent URL. A child page renders breadcrumbs built from its parent chain (each ancestor links to its own page).

Two ways to organise pages:

Slugs may be a slash path (e.g. docs/getting-started) or flat — your choice; they accept lowercase a-z0-9- segments joined by single / (no leading, trailing or doubled slashes).

Pinning a page to the navigation menu

In the page editor, tick Pin to navigation menu to surface the page as a link in the forum's index sidebar navigation — the same menu that holds All Discussions and links added by other extensions (Members, Badges, …). When pinned, two optional fields appear:

Pinned links are ordered exactly like the admin page list (parent/child tree, then per-level order) and honour every visibility rule — a draft, hidden, restricted or group-limited page is only shown in the menu to viewers who are allowed to open it. Nothing is pinned by default.

Redirection pages

A Redirection page (content type Redirection) forwards visitors to another address — enter an https://… URL or a root-relative /path (e.g. /tags). The target is validated on save, so it can never carry a javascript: or data: scheme.

Two behaviours, chosen per page with Redirect immediately:

Either way the visit is counted first. Combined with pinning, this is the easiest way to add a custom menu link — internal or external — to the forum navigation. The menu link points at the page's own /p/{slug} (not straight at the destination) precisely so those clicks pass through the view counter before forwarding.

Tip: to redirect, use this content type — don't write a PHP page that calls header('Location: …'). PHP pages are rendered inline (their output is captured, not sent as a raw response), so header() and exit() won't work there.

Per-tree breadcrumb styling

On a root page (Parent Page = none), tick Custom breadcrumbs CSS? to reveal a small CSS editor. Whatever you write applies to the breadcrumbs of that page and everything nested under it — target .AdvancedPages-breadcrumbs. For example, hide them entirely:

Page visibility

Option Description
Published Accessible to permitted users.
Draft Page exists but is not accessible.
Hidden Only visible to administrators.
Restricted Requires login to view.
Group access Restrict to specific user groups.

Permissions

Out of the box, only administrators can create, edit or delete pages. To let other groups help, you grant access in two places:

  1. The admin Permissions page — for everyday things: who can create the safe page types (Plain Text, BBCode, Markdown), who can edit/delete pages, and who can see spoiler content. Just tick the boxes.
  2. One console command — for the two powerful page types, HTML and PHP.

Why are HTML and PHP separate? An HTML page can run JavaScript in every visitor's browser, and a PHP page runs code on your server. Letting a group create those is a big deal, so it's deliberately kept out of the clickable admin panel (you can't enable it by accident) and done from the server console instead.

What each permission lets a group do:

Permission Where you grant it Lets the group…
Create: Plain Text / BBCode / Markdown Admin → Permissions page Create those (safe, escaped) page types.
Create: HTML Console (below) Create HTML pages (raw HTML/JS).
Create: PHP Console (below) Create PHP pages (server-side code).
Manage Advanced Pages Admin → Permissions page Edit & delete existing pages.
View spoiler content Admin → Permissions page See [spoiler] content (default: Members).

Editing also needs Manage Advanced Pages. On top of that, turning a page into — or editing — an HTML/PHP page needs that group's HTML/PHP create permission too, so a manager can't sneak executable code in without it.

The console command

Recipes:

Changes apply immediately — no cache clear. Administrators always have every permission, so you can't (and don't need to) target them.

Memory requirements

Flarum compiles all extension LESS styles together. If you get PHP Fatal error: Allowed memory size exhausted:

  1. Set memory_limit to at least 256M in php.ini (512M+ recommended).
  2. WAMP users: Apache with mod_fcgid uses the php.ini in the Apache bin directory, not the PHP directory.
  3. Restart Apache after changes.

Security

This extension intentionally lets trusted authors publish raw HTML and run server-side PHP — that is the whole point. Understand the model before delegating page creation:

Database support

Works on every database Flarum 2.x supports — MySQL / MariaDB, SQLite 3.38+, and PostgreSQL — including the per-group page visibility feature (uses Laravel's cross-database JSON query builder).

Note on cache clearing (Windows)

After php flarum cache:clear or enabling/disabling the extension, the very first page load may briefly return HTTP 500 and succeed on refresh. This is a known Flarum/Symfony behaviour on Windows (the translation-catalogue cache is rebuilt and concurrent first requests can collide on the file rename) — it affects the whole forum, not just this extension, and clears itself once the cache is warm. Loading any one page once after clearing the cache avoids it.

Links

License

MIT License. See LICENSE for details.


All versions of flarum-advanced-pages with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
flarum/core Version ^2.0.0-rc.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tryhackx/flarum-advanced-pages contains the following files

Loading the files please wait ...