Download the PHP package restruct/silverstripe-faq without Composer

On this page you can find all versions of the php package restruct/silverstripe-faq. 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 silverstripe-faq

Restruct FAQ Module

Maintained by Restruct. If this module saves you time, you can support ongoing maintenance.

A Silverstripe module for managing and displaying frequently asked questions (FAQs).

Features

Requirements

Branch Module version Silverstripe PHP
main 1.1.x ^5 \|\| ^6 ^8.1 (Silverstripe 6 itself needs 8.3+)
(tags only) 1.0.x ^5 not declared (Silverstripe 5 needs 8.1+)

composer.json is the source of truth. Silverstripe 5 is supported until its end of life in April 2027; Silverstripe 4 is not supported.

Dependencies: silverstripe/cms and symbiote/silverstripe-gridfieldextensions (^4 on Silverstripe 5, ^5 on Silverstripe 6), for the drag-sortable GridFields.

Silverstripe 6: TinyMCE is a separate module there and silverstripe/recipe-cms does not include it. Without silverstripe/htmleditor-tinymce installed, the Answer field is not a rich-text editor. Most Silverstripe 6 projects already require it; the module lists it under suggest.

Installation

Then build the database:

The package is restruct/silverstripe-faq (singular); the repository is silverstripe-faqs.

FAQPage extends your project's Page class and FAQPageController extends PageController, as with any page-type module, so the project must define both (every standard Silverstripe project does).

Usage

In the CMS

  1. Managing FAQs: Go to "FAQs" in the main menu

    • First create categories under the "Faq Category" tab
    • Then add FAQs under the "Faq Question" tab
    • Assign each FAQ to a category (a question can be in several)
    • Within a category, drag the questions into the order they should appear on the page
  2. Creating an FAQ Page:
    • Create a new page of type "FAQ Page"
    • Go to the "FAQ Categories" tab
    • Select which categories you want to display on this page
    • Drag the categories into the order they should appear on the page

Ordering

Template Customization

The default FAQ page template (templates/Restruct/FAQ/Pages/Layout/FAQPage.ss) uses a custom accordion implementation with vanilla JavaScript and CSS - no external dependencies required.

Client Assets

The module includes the following client-side files:

  1. faq-accordion.js: Core accordion functionality

    • Handles expand/collapse behavior
    • Dispatches faq:opened custom events for tracking
    • Keyboard navigation support
  2. faq-view-tracker.js: Analytics tracking

    • Tracks when users open FAQ items
    • CSRF token protection
    • Session-based deduplication
  3. faq-accordion.css: Accordion styling
    • Clean, modern design
    • Smooth transitions
    • Mobile responsive

FAQPageController::init() requires all three on every FAQ page.

Customizing the Template

You can customize the FAQ display in several ways:

  1. Override the template: Create your own template in your theme directory:

  2. Override the styles: Override CSS variables or classes in your theme's stylesheet

  3. Extend functionality: Listen to the faq:opened custom event to add your own behavior:

Template Structure

The template provides two main methods:

Refer to the default template for implementation examples.

To keep the accordion and view counting working in your own template, render each question's toggle as the default template does. The scripts bind to nothing else:

A toggle without the faq-toggle class or a matching aria-controls target fails silently: the answer does not open, there is no console error and ViewCount stays 0. A toggle missing either data-* attribute still opens, but the tracker logs FAQ tracking: Missing FAQ ID or security token to the console and counts nothing.

View counting

faq-view-tracker.js posts to faq-api/incrementView (routed to FaqApiController in _config/routes.yml) when a question is opened. The endpoint accepts only POST with a valid SecurityID token, counts a question at most once per session, and answers JSON:

Response When
405 not a POST
403 missing or wrong security token
400 no faqId
404 no question with that ID
200 {"success":true,"viewCount":n,"alreadyCounted":false} counted
200 {"success":true,"viewCount":n,"alreadyCounted":true} already counted in this session

The count is shown in the "FAQs" admin list (ViewCount) and is not editable in the CMS.

The script posts to the absolute path /faq-api/incrementView, so view counting assumes the site runs at the domain root.

Configuration

All options are standard Silverstripe private static config, set in YAML:

Class Option Default
Restruct\FAQ\Admin\FAQAdmin url_segment faq
menu_title FAQs
menu_icon_class font-icon-help-circled
menu_priority 3
Restruct\FAQ\Pages\FAQPage class_description (and description on Silverstripe 5 before 5.4) A page that displays frequently asked questions organized by categories
cms_icon_class (Silverstripe 6) / icon_class (Silverstripe 5) font-icon-help-circled

The FAQs admin removes the export, print and import buttons from both of its GridFields.

Running the tests

The module cannot be tested on its own: it needs a host Silverstripe project with a Page and PageController. Require it there through a Composer path repository with symlink: true - /tests is export-ignore, so a dist or mirrored install contains no tests - and add its test namespace to the host's autoload-dev:

Then:

CI runs the same suite against Silverstripe 5 and 6 on every push; see .github/workflows/ci.yml.

Licence

MIT, see CHANGELOG.md.


All versions of silverstripe-faq with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
silverstripe/vendor-plugin Version ^2 || ^3
silverstripe/cms Version ^5 || ^6
symbiote/silverstripe-gridfieldextensions Version ^4 || ^5
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 restruct/silverstripe-faq contains the following files

Loading the files please wait ...