1. Go to this page and download the library: Download milpa/console library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
milpa / console example snippets
use Milpa\Command\Operation;
new Operation(
name: 'create_post',
description: 'Create a draft post',
handler: [PostService::class, 'create'],
inputSchema: ['type' => 'object', 'properties' => ['title' => ['type' => 'string']]],
mutating: true,
use Milpa\Console\CliProjector;
use Milpa\Console\McpProjector;
// CLI: derives `--title=…` from the schema, coerces the string argv into typed input, and
// enforces the signature gate before a mutating operation runs.
(new CliProjector($authorizer))->run($operation, $argv, $container, $write);
// MCP: the same operation becomes a tool an agent can list and call.
(new McpProjector())->project($operations, $registry, $container);
use Milpa\Console\Http\HttpProjector;
// $psr17 is any PSR-17 factory pair you already have (Nyholm, Guzzle, Laminas…).
$projector = new HttpProjector($operations, $container, $psr17, $psr17, policy: $yourPolicy);
$routes = $projector->routes(); // hand these to your router
$model = $projector->project($op); // or just ask what an operation would expose
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.