PHP Classes

File: bin/quickwp-mcp

Recommend this page to a friend!
  Packages of Adrian M   QuickWP   bin/quickwp-mcp   Download  
File: bin/quickwp-mcp
Role: Example script
Content type: text/plain
Description: Example script
Class: QuickWP
Manage WordPress sites using the REST API
Author: By
Last change:
Date: 12 hours ago
Size: 710 bytes
 

 

Contents

Class file image Download
#!/usr/bin/env php
<?php

declare(strict_types=1);

$autoloadPaths = [
    __DIR__ . '/../vendor/autoload.php',
    __DIR__ . '/../../../autoload.php',
];

$loaded = false;
foreach ($autoloadPaths as $path) {
    if (is_file($path)) {
        require_once $path;
        $loaded = true;
        break;
    }
}

if (!$loaded) {
    fwrite(STDERR, "Error: Composer autoload.php not found. Run 'composer install'.\n");
    exit(1);
}

$baseDir = getenv('QUICKWP_BASE_DIR') ?: (getcwd() ?: dirname(__DIR__));
if (!is_file($baseDir . '/quick-config.php') && !is_file($baseDir . '/quick-sites.php')) {
    $baseDir = dirname(__DIR__);
}

$server = new QuickWP\Mcp\McpServer($baseDir);
$server->serve(STDIN, STDOUT);