Create a custom module ( internal server error ) xibo 1.8.11

I’m creating a custom module. when i try to install it it doesn’t respond after clicking the installation button.
i receive 500 internal server error.

directory structure is

i have placed the json file in Xibo/shared/cms/custom/MyModule.json
code in the MyModule.json is following
“title”: “My Custom Module”,
“author”: “Saqib Ali”,
“description”: “A module for testing”,
“name”: “MyModule”,
“class”: “Xibo\Custom\MyModule\MyModule”

my class file is in Xibo/cms/custom/MyModule/MyModule.php

code in the class file is following


namespace Xibo\Custom\MyModule;

* Install or Update this module
* @param ModuleFactory $moduleFactory

use Respect\Validation\Validator as v;
use Xibo\Exception\InvalidArgumentException;
use Xibo\Factory\ModuleFactory;

class MyModule extends ModuleWidget {

public function installOrUpdate($moduleFactory)
  if ($this->module == null) {
    // Install
    $module = $moduleFactory->createEmpty();
    $module->name = 'My Module';
    $module->type = 'MyModule';
    $module->class = 'Xibo\Custom\MyModule\MyModule';
    $module->description = 'A module for displaying my information.';
    $module->imageUri = 'Xibo/Custom/MyModule/';
    $module->enabled = 1;
    $module->previewEnabled = 1;
    $module->assignable = 1;
    $module->regionSpecific = 1;
    $module->renderAs = 'html';
    $module->schemaVersion = $this->codeSchemaVersion;
    $module->defaultDuration = 60;
    $module->settings = [];
    $module->viewPath = '../custom/MyModule';

    // Set the newly created module and then call install

  // Install and additional module files that are required.

 * Install Files
public function installFiles()
  // Use JQuery and some Xibo resources
  $this->mediaFactory->createModuleSystemFile(PROJECT_ROOT . '/modules/vendor/jquery-1.11.1.min.js')->save();


 * Form for updating the module settings
public function settingsForm()
  // Return the name of the TWIG file to render the settings form
  return 'MyModule-form-settings';

/** @inheritdoc */
public function isValid()
    if ($this->getUseDuration() == 1 && $this->getDuration() == 0)
        throw new InvalidArgumentException(__('Please enter a duration'), 'duration');

    if (!v::url()->notEmpty()->validate(urldecode($this->getOption('uri'))))
        throw new InvalidArgumentException(__('Please enter a link'), 'uri');

    return self::$STATUS_VALID;

public function GetResource($displayId = 0)
        ->appendBody('<h1>My HTML</h1>')
        ->appendJavaScript('$(document).ready(function() { $("h1").html("My Altered HTML"); } ');

    return $this->finaliseGetResource();



Please i need guide where i have done wrong. Any help is appreciated.

in your .json file, you have

you will want to have double \\ there (as per manual page) ie


in php file single \ is correct, but in json you need double .

If that’s not all there is wrong with it, you’d need to enable CMS auditing, recreate the issue and check logs for details.

i have double \ in json but still its giving 500 internal server error

can you please share the link to use cms auditing? i have enabled it but it isn’t displaying much information in
Advanced > Logs