GitHub

Custom index.php

Another option is to create the \AdminNeo\Admin instance inside your own index.php file. In this case, implement adminneo_instance() function in the global namespace and include AdminNeo file placed in the non-public directory:

<?php

function adminneo_instance()
{
    // Define configuration.
    $config = [
        "colorVariant" => "green",
    ];

    // Use the factory method to create the Admin instance.
    return \AdminNeo\Admin::create($config);
}

// Include AdminNeo file.
include "/non-public-path/adminneo.php";

Or with derived class and plugins:

<?php

function adminneo_instance()
{
    class CustomAdmin extends \AdminNeo\Admin
    {
        public function getServiceTitle()
        {
            return "Custom Service";
        }
    }

    // Define configuration.
    $config = [
        "colorVariant" => "green",
    ];

    // Enable plugins.
    $plugins = [
        new \AdminNeo\JsonPreviewPlugin(),
        new \AdminNeo\XmlDumpPlugin(),
        new \AdminNeo\FileUploadPlugin("data/"),
    ];

    // Use the factory method to create the CustomAdmin instance.
    return CustomAdmin::create($config, $plugins);
}

// Include AdminNeo file.
include "/non-public-path/adminneo.php";